Skip to content

Commit

Permalink
fix(userspace/libscap): fix memleak in scap-open example when killed …
Browse files Browse the repository at this point in the history
…by signal handler.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP authored and poiana committed Mar 19, 2024
1 parent c094c53 commit 2e38d22
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions userspace/libscap/examples/01-open/scap_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,9 @@ void print_stats()

static void signal_callback(int signal)
{
scap_stop_capture(g_h);
print_stats();
scap_close(g_h);
exit(EXIT_SUCCESS);
}

Expand Down Expand Up @@ -987,8 +989,5 @@ int main(int argc, char** argv)
g_nevts++;
}

scap_stop_capture(g_h);
print_stats();
scap_close(g_h);
return EXIT_SUCCESS;
signal_callback(-1);
}

0 comments on commit 2e38d22

Please sign in to comment.