From: Iain Patterson Date: Thu, 3 Feb 2011 19:00:19 +0000 (+0000) Subject: Don't leak memory reading REG_SZ values. X-Git-Tag: v2.8~11 X-Git-Url: http://git.iain.cx/?p=nssm.git;a=commitdiff_plain;h=e200c1086d1f9fbf85d40211d2284d29661c5277 Don't leak memory reading REG_SZ values. --- diff --git a/registry.cpp b/registry.cpp index cb0b3e6..0a74bd8 100644 --- a/registry.cpp +++ b/registry.cpp @@ -124,6 +124,7 @@ int expand_parameter(HKEY key, char *value, char *data, unsigned long datalen) { /* Technically we shouldn't expand environment strings from REG_SZ values */ if (type != REG_EXPAND_SZ) { memmove(data, buffer, buflen); + HeapFree(GetProcessHeap(), 0, buffer); return 0; }