From 411e8599f39a601b26429b3d1183488c413eb21b Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 24 Sep 2014 18:31:52 +0200 Subject: Call RegCloseKey only if handle is valid. --- src/Common/Registry.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Common/Registry.c b/src/Common/Registry.c index a68e5f18..0b17dc51 100644 --- a/src/Common/Registry.c +++ b/src/Common/Registry.c @@ -114,7 +114,8 @@ char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *st if (RegQueryValueEx (hkey, name, 0, 0, (LPBYTE) value, &size) == ERROR_SUCCESS) StringCbCopyA (str, maxLen,value); - RegCloseKey (hkey); + if (hkey) + RegCloseKey (hkey); return str; } -- cgit v1.2.3