Remove memory leak: If the check of the data fails, the data itself is leaked.
Signed-off-by: Holger Vogt <holger.vogt@uni-due.de>
This commit is contained in:
parent
4afc5ed5b5
commit
6bce493d25
|
|
@ -50,11 +50,17 @@ ft_getpnames(wordlist *wl, bool check)
|
||||||
if (rv)
|
if (rv)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (check && !checkvalid(pn))
|
/* If validation is requested, do it and return NULL on failure. The
|
||||||
return (NULL);
|
* structure must also be freed if the check fails since it is not
|
||||||
|
* being returned. */
|
||||||
|
if (check && !checkvalid(pn)) {
|
||||||
|
free_pnode(pn);
|
||||||
|
return (struct pnode *) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return (pn);
|
return (pn);
|
||||||
}
|
} /* end of function ft_getpnames */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* See if there are any variables around which have length 0 and are
|
/* See if there are any variables around which have length 0 and are
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue