mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-09 11:17:37 +01:00
funopen: Fix memory leak in funopen_close() when closefn is NULL
We need to free the cookiewrap even when the closefn method is NULL. Warned-by: gcc ASAN
This commit is contained in:
parent
3d6b6ead64
commit
cfeafeabad
@ -87,10 +87,10 @@ funopen_close(void *cookie)
|
|||||||
struct funopen_cookie *cookiewrap = cookie;
|
struct funopen_cookie *cookiewrap = cookie;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (cookiewrap->closefn == NULL)
|
if (cookiewrap->closefn)
|
||||||
return 0;
|
rc = cookiewrap->closefn(cookiewrap->orig_cookie);
|
||||||
|
else
|
||||||
rc = cookiewrap->closefn(cookiewrap->orig_cookie);
|
rc = 0;
|
||||||
|
|
||||||
free(cookiewrap);
|
free(cookiewrap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user