Skip to content

Commit

Permalink
fix(libscap): free proclist info upon platform close
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Guerra <[email protected]>
  • Loading branch information
LucaGuerra authored and poiana committed Feb 15, 2024
1 parent 3d5d2d3 commit 3b8e4f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions userspace/libscap/scap-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions userspace/libscap/scap_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 5 additions & 0 deletions userspace/libscap/scap_procs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 3b8e4f1

Please sign in to comment.