Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/lsof.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,17 @@ enum lsof_error lsof_gather(struct lsof_context *ctx,
* You should call `lsof_free_result` to free all `struct lsof_result`
* before destroying the context.
*
* ctx may be NULL.
*
* You must not use the context anymore after this call.
*
* \since API version 1
*/
void lsof_destroy(struct lsof_context *ctx);

/** Free struct lsof_result
*
* result may be NULL.
*
* \since API version 1
*/
Expand Down
3 changes: 3 additions & 0 deletions lib/lsof.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ void lsof_free_result(struct lsof_result *result) {
int pi, fi;
struct lsof_process *p;
struct lsof_file *f;
if (!result) {
return;
}
for (pi = 0; pi < result->num_processes; pi++) {
p = &result->processes[pi];
/* Free files */
Expand Down
Loading