mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-07 16:54:01 +01:00
Free old argument even if setting to NULL.
This commit is contained in:
parent
9fc2c34a3b
commit
567741caf5
@ -183,11 +183,12 @@ args_has(struct args *args, u_char ch)
|
|||||||
void
|
void
|
||||||
args_set(struct args *args, u_char ch, const char *value)
|
args_set(struct args *args, u_char ch, const char *value)
|
||||||
{
|
{
|
||||||
if (value != NULL) {
|
|
||||||
if (args->values[ch] != NULL)
|
if (args->values[ch] != NULL)
|
||||||
xfree(args->values[ch]);
|
xfree(args->values[ch]);
|
||||||
|
if (value != NULL)
|
||||||
args->values[ch] = xstrdup(value);
|
args->values[ch] = xstrdup(value);
|
||||||
}
|
else
|
||||||
|
args->values[ch] = NULL;
|
||||||
bit_set(args->flags, ch);
|
bit_set(args->flags, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user