|
|
ddf19c |
From 9e0f5b64f30c2f841f297e25c2f3a6d82c8a16b8 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ddf19c |
Date: Mon, 27 Jan 2020 19:01:57 +0100
|
|
|
ddf19c |
Subject: [PATCH 086/116] virtiofsd: fix memory leak on lo.source
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
Message-id: <20200127190227.40942-83-dgilbert@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93536
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 082/112] virtiofsd: fix memory leak on lo.source
|
|
|
ddf19c |
Bugzilla: 1694164
|
|
|
ddf19c |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
From: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
valgrind reported that lo.source is leaked on quiting, but it was defined
|
|
|
ddf19c |
as (const char*) as it may point to a const string "/".
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
|
|
|
ddf19c |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e)
|
|
|
ddf19c |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
tools/virtiofsd/passthrough_ll.c | 7 ++++---
|
|
|
ddf19c |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
index af050c6..056ebe8 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
+++ b/tools/virtiofsd/passthrough_ll.c
|
|
|
ddf19c |
@@ -115,7 +115,7 @@ struct lo_data {
|
|
|
ddf19c |
int writeback;
|
|
|
ddf19c |
int flock;
|
|
|
ddf19c |
int xattr;
|
|
|
ddf19c |
- const char *source;
|
|
|
ddf19c |
+ char *source;
|
|
|
ddf19c |
double timeout;
|
|
|
ddf19c |
int cache;
|
|
|
ddf19c |
int timeout_set;
|
|
|
ddf19c |
@@ -2497,9 +2497,8 @@ int main(int argc, char *argv[])
|
|
|
ddf19c |
fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
|
|
|
ddf19c |
exit(1);
|
|
|
ddf19c |
}
|
|
|
ddf19c |
-
|
|
|
ddf19c |
} else {
|
|
|
ddf19c |
- lo.source = "/";
|
|
|
ddf19c |
+ lo.source = strdup("/");
|
|
|
ddf19c |
}
|
|
|
ddf19c |
if (!lo.timeout_set) {
|
|
|
ddf19c |
switch (lo.cache) {
|
|
|
ddf19c |
@@ -2570,5 +2569,7 @@ err_out1:
|
|
|
ddf19c |
close(lo.root.fd);
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
+ free(lo.source);
|
|
|
ddf19c |
+
|
|
|
ddf19c |
return ret ? 1 : 0;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|