[pulseaudio-discuss] [PATCH] augment-properties: fix a memory leak
Tanu Kaskinen
tanuk at iki.fi
Wed Dec 6 22:39:14 UTC 2017
If the desktop file is not found, fn was not being freed after the last
loop iteration.
CID: 1462477
---
src/modules/module-augment-properties.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c
index f0584328d..4c38e7418 100644
--- a/src/modules/module-augment-properties.c
+++ b/src/modules/module-augment-properties.c
@@ -140,6 +140,7 @@ static char * find_desktop_file_in_dir(struct rule *r, const char *desktop_file_
if (stat(fn, st) == 0) {
return fn;
} else {
+ pa_xfree(fn);
#ifdef DT_DIR
DIR *desktopfiles_dir;
struct dirent *dir;
@@ -152,13 +153,14 @@ static char * find_desktop_file_in_dir(struct rule *r, const char *desktop_file_
|| pa_streq(dir->d_name, ".."))
continue;
- pa_xfree(fn);
fn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", desktop_file_dir, dir->d_name, r->process_name);
if (stat(fn, st) == 0) {
closedir(desktopfiles_dir);
return fn;
}
+
+ pa_xfree(fn);
}
closedir(desktopfiles_dir);
}
--
2.14.2
More information about the pulseaudio-discuss
mailing list