summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-01-12 19:48:59 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-01-12 19:48:59 +0000
commit1afec9138f848cfba517bd2d80167b27216b9df9 (patch)
tree6839b17f33e2085868f18007028b788e474a5a3d
parent08089edcd25b2105a7599309afd0225e839debc6 (diff)
downloadfocaccia-qemu-1afec9138f848cfba517bd2d80167b27216b9df9.tar.gz
focaccia-qemu-1afec9138f848cfba517bd2d80167b27216b9df9.zip
qemu-io: fix a memory leak
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>
-rw-r--r--qemu-io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/qemu-io.c b/qemu-io.c
index 65dee13731..5b24c5eec2 100644
--- 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;