Commit-ID: 54a35dfe65b5c58bb60bb66c18917185e353f658 Gitweb: http://git.kernel.org/tip/54a35dfe65b5c58bb60bb66c18917185e353f658 Author: Pekka Enberg <penberg@xxxxxxxxxx> AuthorDate: Tue, 3 Jan 2012 19:49:49 +0200 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Tue, 3 Jan 2012 19:49:49 +0200 kvm tools, 9p: Fix memory leak in virtio_9p_attach() This patch fixes the following valgrind reported memory leak: ==7684== 20 bytes in 8 blocks are definitely lost in loss record 3 of 46 ==7684== at 0x4A0649D: malloc (vg_replace_malloc.c:236) ==7684== by 0x4116B5: virtio_p9_pdu_readf (9p-pdu.c:110) ==7684== by 0x40FD8C: virtio_p9_attach (9p.c:354) ==7684== by 0x410E80: virtio_p9_do_io (9p.c:1154) ==7684== by 0x40DB45: thread_pool__threadfunc (threadpool.c:56) ==7684== by 0x3DE7007B30: start_thread (in /lib64/libpthread-2.14.so) ==7684== by 0x3DE68DFD2C: clone (in /lib64/libc-2.14.so) Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/virtio/9p.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 3d1c624..28f5ed7 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -354,6 +354,9 @@ static void virtio_p9_attach(struct p9_dev *p9dev, virtio_p9_pdu_readf(pdu, "ddssd", &fid_val, &afid, &uname, &aname, &uid); + free(uname); + free(aname); + /* Reset everything */ for (i = 0; i < VIRTIO_P9_MAX_FID; i++) p9dev->fids[i].fid = P9_NOFID; -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html