mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
61cfc44982
commit
eb68a33b5f
1 changed files with 4 additions and 3 deletions
|
@ -115,7 +115,7 @@ struct lo_data {
|
||||||
int writeback;
|
int writeback;
|
||||||
int flock;
|
int flock;
|
||||||
int xattr;
|
int xattr;
|
||||||
const char *source;
|
char *source;
|
||||||
double timeout;
|
double timeout;
|
||||||
int cache;
|
int cache;
|
||||||
int timeout_set;
|
int timeout_set;
|
||||||
|
@ -2497,9 +2497,8 @@ int main(int argc, char *argv[])
|
||||||
fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
|
fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
lo.source = "/";
|
lo.source = strdup("/");
|
||||||
}
|
}
|
||||||
if (!lo.timeout_set) {
|
if (!lo.timeout_set) {
|
||||||
switch (lo.cache) {
|
switch (lo.cache) {
|
||||||
|
@ -2570,5 +2569,7 @@ err_out1:
|
||||||
close(lo.root.fd);
|
close(lo.root.fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(lo.source);
|
||||||
|
|
||||||
return ret ? 1 : 0;
|
return ret ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue