[PATCH 4/4] winemenubuilder: Fix memory leak in generate_associations (Coverity)
Alex Henrie
alexhenrie24 at gmail.com
Tue Dec 28 22:14:11 CST 2021
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
programs/winemenubuilder/winemenubuilder.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 900e81dbcf2..958f9b1f1d7 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -2043,7 +2043,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
WCHAR *iconW = NULL;
WCHAR *contentTypeW = NULL;
WCHAR *mimeType = NULL;
- const WCHAR *friendlyAppName;
+ WCHAR *friendlyAppName = NULL;
WCHAR *progIdW = NULL;
WCHAR *mimeProgId = NULL;
struct rb_string_entry *entry;
@@ -2098,7 +2098,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
openWithIcon = compute_native_identifier(0, executableW, NULL);
friendlyAppName = assoc_query(ASSOCSTR_FRIENDLYAPPNAME, extensionW, L"open");
- if (!friendlyAppName) friendlyAppName = L"A Wine application";
+ if (!friendlyAppName) friendlyAppName = xwcsdup(L"A Wine application");
progIdW = reg_get_valW(HKEY_CLASSES_ROOT, extensionW, NULL);
if (!progIdW) goto end; /* no progID => not a file type association */
@@ -2144,6 +2144,7 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
heap_free(iconW);
heap_free(contentTypeW);
heap_free(mimeType);
+ heap_free(friendlyAppName);
heap_free(progIdW);
}
heap_free(extensionW);
--
2.34.1
More information about the wine-devel
mailing list