Skip to content

Commit

Permalink
Make free_opt(NULL) work like free(NULL)
Browse files Browse the repository at this point in the history
Coverity spotted such a call in the error path of parse_select_node()
in the Juniper auth code, after allocating 'opt' fails.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed Oct 9, 2019
1 parent a357dfc commit 33260f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auth-common.c
Expand Up @@ -138,6 +138,9 @@ void free_pass(char **p)

void free_opt(struct oc_form_opt *opt)
{
if (!opt)
return;

/* for SELECT options, opt->value is a pointer to oc_choice->name */
if (opt->type != OC_FORM_OPT_SELECT) {
free_pass(&opt->_value);
Expand Down

0 comments on commit 33260f4

Please sign in to comment.