mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 01:18:52 +00:00
Sync OpenBSD patchset 859:
Free old argument even if setting to NULL.
This commit is contained in:
parent
d718a14bd0
commit
19e81ffda5
@ -1,4 +1,4 @@
|
|||||||
/* $Id: arguments.c,v 1.2 2011-01-07 14:46:57 tcunha Exp $ */
|
/* $Id: arguments.c,v 1.3 2011-02-15 15:24:40 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -182,11 +182,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