Fix potential access of freed data (only if we couldn't create the

second of two registry keys, so pretty unlikely).

[originally from svn r5021]
This commit is contained in:
Jacob Nevins 2004-12-22 23:17:02 +00:00
Родитель 56d5dc7eec
Коммит f13f9f6420
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -82,13 +82,14 @@ void *open_settings_w(const char *sessionname, char **errmsg)
return NULL;
}
ret = RegCreateKey(subkey1, p, &sesskey);
sfree(p);
RegCloseKey(subkey1);
if (ret != ERROR_SUCCESS) {
*errmsg = dupprintf("Unable to create registry key\n"
"HKEY_CURRENT_USER\\%s\\%s", puttystr, p);
sfree(p);
return NULL;
}
sfree(p);
return (void *) sesskey;
}