Don't leak memory reading REG_SZ values.
authorIain Patterson <me@iain.cx>
Thu, 3 Feb 2011 19:00:19 +0000 (19:00 +0000)
committerIain Patterson <me@iain.cx>
Thu, 3 Feb 2011 19:00:19 +0000 (19:00 +0000)
registry.cpp

index cb0b3e6..0a74bd8 100644 (file)
@@ -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 */\r
   if (type != REG_EXPAND_SZ) {\r
     memmove(data, buffer, buflen);\r
+    HeapFree(GetProcessHeap(), 0, buffer);\r
     return 0;\r
   }\r
 \r