diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2019-06-07 05:43:53 +0800 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2020-01-23 16:41:37 +0000 |
commit | eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e (patch) | |
tree | d02f1494faf0ec5f3049a1daedc7abc2c93396a9 /tools | |
parent | 61cfc44982e566c33b9d5df17858e4d5ae373873 (diff) | |
download | qemu-eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e.zip qemu-eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e.tar.gz qemu-eb68a33b5fc5dde87bd9b99b94e7c33a5d8ea82e.tar.bz2 |
virtiofsd: fix memory leak on lo.source
valgrind reported that lo.source is leaked on quiting, but it was defined
as (const char*) as it may point to a const string "/".
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/virtiofsd/passthrough_ll.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index af050c6..056ebe8 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd/passthrough_ll.c @@ -115,7 +115,7 @@ struct lo_data { int writeback; int flock; int xattr; - const char *source; + char *source; double timeout; int cache; int timeout_set; @@ -2497,9 +2497,8 @@ int main(int argc, char *argv[]) fuse_log(FUSE_LOG_ERR, "source is not a directory\n"); exit(1); } - } else { - lo.source = "/"; + lo.source = strdup("/"); } if (!lo.timeout_set) { switch (lo.cache) { @@ -2570,5 +2569,7 @@ err_out1: close(lo.root.fd); } + free(lo.source); + return ret ? 1 : 0; } |