fix more string ownership issues

This commit is contained in:
Bill Currie 2004-01-07 08:54:00 +00:00
parent 2485bed45a
commit 6c447b4b75

View file

@ -317,7 +317,7 @@ qfs_inherit (plitem_t *plist, plitem_t *gdpl, gamedir_t *gamedir,
return; return;
} }
qfs_set_var (vars, "gamedir", base->data); qfs_set_var (vars, "gamedir", base->data);
Hash_Add (dirs, base->data); Hash_Add (dirs, strdup (base->data));
qfs_get_gd_params (gdpl, gamedir, path, vars); qfs_get_gd_params (gdpl, gamedir, path, vars);
qfs_inherit (plist, gdpl, gamedir, path, dirs, vars); qfs_inherit (plist, gdpl, gamedir, path, dirs, vars);
} else if (base->type == QFArray) { } else if (base->type == QFArray) {
@ -333,7 +333,7 @@ qfs_inherit (plitem_t *plist, plitem_t *gdpl, gamedir_t *gamedir,
continue; continue;
} }
qfs_set_var (vars, "gamedir", base->data); qfs_set_var (vars, "gamedir", base->data);
Hash_Add (dirs, base->data); Hash_Add (dirs, strdup (base->data));
qfs_get_gd_params (gdpl, gamedir, path, vars); qfs_get_gd_params (gdpl, gamedir, path, vars);
qfs_inherit (plist, gdpl, gamedir, path, dirs, vars); qfs_inherit (plist, gdpl, gamedir, path, dirs, vars);
} }
@ -367,12 +367,12 @@ qfs_find_gamedir (const char *name, hashtab_t *dirs)
dictkey_t **list = (dictkey_t **) Hash_GetList (qfs_gd_plist->data); dictkey_t **list = (dictkey_t **) Hash_GetList (qfs_gd_plist->data);
dictkey_t **l; dictkey_t **l;
for (l = list; *l; l++) for (l = list; *l; l++)
; puts((*l)->key);
qsort (list, l - list, sizeof (char *), qfs_compare); qsort (list, l - list, sizeof (char *), qfs_compare);
while (l-- != list) { while (l-- != list) {
if (!fnmatch ((*l)->key, name, 0)) { if (!fnmatch ((*l)->key, name, 0)) {
gdpl = (*l)->value; gdpl = (*l)->value;
Hash_Add (dirs, (*l)->key); Hash_Add (dirs, strdup ((*l)->key));
break; break;
} }
} }