forked from github/server
fix a segfault in free_Races
This commit is contained in:
parent
60497da87b
commit
f48dd41538
|
@ -203,7 +203,7 @@ param_t findparam(const char *s, const struct locale * lang)
|
|||
void **tokens = get_translations(lang, UT_PARAMS);
|
||||
critbit_tree *cb = (critbit_tree *)*tokens;
|
||||
if (!cb) {
|
||||
log_warning("no parameters defined in locale %s", locale_name(lang));
|
||||
log_error("no parameters defined in locale %s", locale_name(lang));
|
||||
}
|
||||
else if (cb_find_prefix(cb, str, strlen(str), &match, 1, 0)) {
|
||||
cb_get_kv(match, &i, sizeof(int));
|
||||
|
|
|
@ -269,7 +269,13 @@ void free_races(void) {
|
|||
free(opt);
|
||||
}
|
||||
for (i = 0; races->attack[i].type!=AT_NONE; ++i) {
|
||||
spellref_free(races->attack[i].data.sp);
|
||||
att *at = races->attack + i;
|
||||
if (at->type == AT_SPELL) {
|
||||
spellref_free(at->data.sp);
|
||||
}
|
||||
else {
|
||||
free(at->data.dice);
|
||||
}
|
||||
}
|
||||
spellref_free(races->precombatspell);
|
||||
free(xrefs);
|
||||
|
|
|
@ -105,7 +105,7 @@ extern "C" {
|
|||
typedef struct att {
|
||||
int type;
|
||||
union {
|
||||
const char *dice;
|
||||
char *dice;
|
||||
struct spellref *sp;
|
||||
} data;
|
||||
int flags;
|
||||
|
|
Loading…
Reference in New Issue