]> git.proxmox.com Git - qemu.git/commitdiff
qemu-io: fix a memory leak
authorBlue Swirl <blauwirbel@gmail.com>
Wed, 12 Jan 2011 19:48:59 +0000 (19:48 +0000)
committerBlue Swirl <blauwirbel@gmail.com>
Wed, 12 Jan 2011 19:48:59 +0000 (19:48 +0000)
Fix a memory leak, reported by cppcheck:
[/src/qemu/qemu-io.c:1135]: (error) Memory leak: ctx

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu-io.c

index 65dee13731365fab711446c5e0bc64c83e077bc4..5b24c5eec217c671c9da103c92195880b714c7a7 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1131,8 +1131,10 @@ aio_read_f(int argc, char **argv)
                case 'P':
                        ctx->Pflag = 1;
                        ctx->pattern = parse_pattern(optarg);
-                       if (ctx->pattern < 0)
+                       if (ctx->pattern < 0) {
+                                free(ctx);
                                return 0;
+                        }
                        break;
                case 'q':
                        ctx->qflag = 1;