|
|
1bdc94 |
From d9da0aedd0dc6aeee5751855eda3560f1757910c Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Date: Tue, 26 Jun 2018 09:47:44 +0200
|
|
|
1bdc94 |
Subject: [PATCH 15/89] sheepdog: Fix sd_co_create_opts() memory leaks
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180626094856.6924-2-kwolf@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 81074
|
|
|
1bdc94 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 01/73] sheepdog: Fix sd_co_create_opts() memory leaks
|
|
|
1bdc94 |
Bugzilla: 1513543
|
|
|
1bdc94 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Both the option string for the 'redundancy' option and the
|
|
|
1bdc94 |
SheepdogRedundancy object that is created accordingly could be leaked in
|
|
|
1bdc94 |
error paths. This fixes the memory leaks.
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Reported by Coverity (CID 1390614 and 1390641).
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Message-id: 20180503153509.22223-1-kwolf@redhat.com
|
|
|
1bdc94 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit a2cb9239b7610ffb00f9ced5cd7640d40b0e1ccf)
|
|
|
1bdc94 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
block/sheepdog.c | 4 +++-
|
|
|
1bdc94 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/block/sheepdog.c b/block/sheepdog.c
|
|
|
1bdc94 |
index d1c9bf5..933880c 100644
|
|
|
1bdc94 |
--- a/block/sheepdog.c
|
|
|
1bdc94 |
+++ b/block/sheepdog.c
|
|
|
1bdc94 |
@@ -1977,6 +1977,7 @@ static SheepdogRedundancy *parse_redundancy_str(const char *opt)
|
|
|
1bdc94 |
} else {
|
|
|
1bdc94 |
ret = qemu_strtol(n2, NULL, 10, &parity);
|
|
|
1bdc94 |
if (ret < 0) {
|
|
|
1bdc94 |
+ g_free(redundancy);
|
|
|
1bdc94 |
return NULL;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
@@ -2172,7 +2173,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
1bdc94 |
BlockdevCreateOptions *create_options = NULL;
|
|
|
1bdc94 |
QDict *qdict, *location_qdict;
|
|
|
1bdc94 |
Visitor *v;
|
|
|
1bdc94 |
- const char *redundancy;
|
|
|
1bdc94 |
+ char *redundancy;
|
|
|
1bdc94 |
Error *local_err = NULL;
|
|
|
1bdc94 |
int ret;
|
|
|
1bdc94 |
|
|
|
1bdc94 |
@@ -2240,6 +2241,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
|
|
1bdc94 |
fail:
|
|
|
1bdc94 |
qapi_free_BlockdevCreateOptions(create_options);
|
|
|
1bdc94 |
qobject_unref(qdict);
|
|
|
1bdc94 |
+ g_free(redundancy);
|
|
|
1bdc94 |
return ret;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|