Commit cfeafeab authored by Guillem Jover's avatar Guillem Jover

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
parent 3d6b6ead
......@@ -87,10 +87,10 @@ funopen_close(void *cookie)
struct funopen_cookie *cookiewrap = cookie;
int rc;
if (cookiewrap->closefn == NULL)
return 0;
rc = cookiewrap->closefn(cookiewrap->orig_cookie);
if (cookiewrap->closefn)
rc = cookiewrap->closefn(cookiewrap->orig_cookie);
else
rc = 0;
free(cookiewrap);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment