Fix a memory leak, reported by cppcheck:
[/src/qemu/qemu-io.c:1135]: (error) Memory leak: ctx

Signed-off-by: Blue Swirl <blauwir...@gmail.com>
---
 qemu-io.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 65dee13..5b24c5e 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;
-- 
1.6.2.4

Reply via email to