free (*val); *val = NULL;
xfree (*val); *val = NULL;
load_config_value (HKEY hk, const char *path, const char *key, char **val){    HKEY h;    DWORD size=0, type;    int ec;    if (hk == NULL)	hk = HKEY_CURRENT_USER;    ec = RegOpenKeyEx (hk, path, 0, KEY_READ, &h);    if (ec != ERROR_SUCCESS)	return load_config_value_ext (val);    ec = RegQueryValueEx(h, key, NULL, &type, NULL, &size);    if (ec != ERROR_SUCCESS) {	RegCloseKey (h);	return -1;    }    *val = xcalloc(1, size+1);    ec = RegQueryValueEx (h, key, NULL, &type, (BYTE*)*val, &size);    if (ec != ERROR_SUCCESS) {	free (*val); *val = NULL;	RegCloseKey (h);	return -1;    }    RegCloseKey (h);    return 0;}