Skip to content

Commit

Permalink
Fix: possible memory leak detected via ccc-analyzer
Browse files Browse the repository at this point in the history
Destroy ipc ctx when fork fails.

Bug Summary
File:	misc/ipc.c
Warning:	line 191, column 14
Potential leak of memory pointed to by 'pctx'
  • Loading branch information
jjnicola committed Oct 21, 2022
1 parent e935e0a commit 134ee40
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions misc/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,10 @@ ipc_exec_as_process (enum ipc_protocol type, struct ipc_exec_context exec_ctx)
gvm_log_lock ();
pid = fork ();
gvm_log_unlock ();
/* fork error */
if (pid < 0)
{
ipc_destroy (pctx);
return NULL;
}
// we are the child process and execute given function
Expand Down

0 comments on commit 134ee40

Please sign in to comment.