diff --git a/userspace/libscap/scap-int.h b/userspace/libscap/scap-int.h index da98848bf1..952ab70a92 100644 --- a/userspace/libscap/scap-int.h +++ b/userspace/libscap/scap-int.h @@ -76,6 +76,7 @@ void scap_free_userlist(scap_userlist* uhandle); int32_t scap_proc_fill_pidns_start_ts(char* error, struct scap_threadinfo* tinfo, const char* procdirname); bool scap_alloc_proclist_info(struct ppm_proclist_info **proclist_p, uint32_t n_entries, char* error); +void scap_free_proclist_info(struct ppm_proclist_info *proclist); void scap_free_device_table(scap_mountinfo* dev_list); diff --git a/userspace/libscap/scap_platform.c b/userspace/libscap/scap_platform.c index 5ef1faff94..11970adb0f 100644 --- a/userspace/libscap/scap_platform.c +++ b/userspace/libscap/scap_platform.c @@ -50,6 +50,12 @@ static int32_t scap_generic_close_platform(struct scap_platform* platform) platform->m_proclist.m_proclist = NULL; } + if(platform->m_driver_procinfo != NULL) + { + scap_free_proclist_info(platform->m_driver_procinfo); + platform->m_driver_procinfo = NULL; + } + return SCAP_SUCCESS; } diff --git a/userspace/libscap/scap_procs.c b/userspace/libscap/scap_procs.c index 501cfbb4a4..0dfa7731f1 100644 --- a/userspace/libscap/scap_procs.c +++ b/userspace/libscap/scap_procs.c @@ -211,3 +211,8 @@ bool scap_alloc_proclist_info(struct ppm_proclist_info **proclist_p, uint32_t n_ return true; } + +void scap_free_proclist_info(struct ppm_proclist_info *proclist) +{ + free(proclist); +}