Free old argument even if setting to NULL.

This commit is contained in:
Nicholas Marriott 2011-01-30 12:09:30 +00:00
parent 9fc2c34a3b
commit 567741caf5

View File

@ -183,11 +183,12 @@ args_has(struct args *args, u_char ch)
void
args_set(struct args *args, u_char ch, const char *value)
{
if (value != NULL) {
if (args->values[ch] != NULL)
xfree(args->values[ch]);
if (value != NULL)
args->values[ch] = xstrdup(value);
}
else
args->values[ch] = NULL;
bit_set(args->flags, ch);
}