perf evlist: Use zfree() to reduce chances of use after free
Do defensive programming by using zfree() to initialize freed pointers to NULL, so that eventual use after free result in a NULL pointer deref instead of more subtle behaviour. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
c77ceb2eb0
commit
2bfc8134f9
|
@ -2325,7 +2325,7 @@ int evlist__parse_event_enable_time(struct evlist *evlist, struct record_opts *o
|
|||
close_timerfd:
|
||||
close(eet->timerfd);
|
||||
free_eet_times:
|
||||
free(eet->times);
|
||||
zfree(&eet->times);
|
||||
free_eet:
|
||||
free(eet);
|
||||
return err;
|
||||
|
@ -2407,7 +2407,7 @@ void event_enable_timer__exit(struct event_enable_timer **ep)
|
|||
{
|
||||
if (!ep || !*ep)
|
||||
return;
|
||||
free((*ep)->times);
|
||||
zfree(&(*ep)->times);
|
||||
zfree(ep);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue