Skip to contentSkip to conversation

qemu-io: Fix memory leak in 'aio_write -z'

PATCH In review Kevin Wolf 2 participants 2 messages May 9, 2016

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-io: Fix memory leak in 'aio_write -z'

---
 qemu-io-cmds.c | 1 +
 1 file changed, 1 insertion(+)
qemu-io-cmds.c +1 -0
index e34f777..41580b5 100644
@@ -1699,6 +1699,7 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv)
         int64_t count = cvtnum(argv[optind]);
         if (count < 0) {
             print_cvtnum_err(count, argv[optind]);
+            g_free(ctx);
             return 0;
         }
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Kevin Wolf
---
 qemu-io-cmds.c | 1 +
 1 file changed, 1 insertion(+)

Perhaps it would be easier to convert all the mid-function returns into 'goto cleanup', so that we don't have to repeat the cleanups everywhere, but that's more invasive.

Quoted 14 lines
qemu-io-cmds.c +1 -0
index e34f777..41580b5 100644
@@ -1699,6 +1699,7 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv)
         int64_t count = cvtnum(argv[optind]);
         if (count < 0) {
             print_cvtnum_err(count, argv[optind]);
+            g_free(ctx);
             return 0;
         }
 
Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org