Skip to content

Commit

Permalink
fuzzshark: close a leak.
Browse files Browse the repository at this point in the history
If init_progfile_dir() fails, it returns a g_mallocated string with an
error message.  After printing the error message, free the string.
  • Loading branch information
guyharris committed May 22, 2021
1 parent f0abd29 commit c22b857
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fuzz/fuzzshark.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ fuzz_init(int argc _U_, char **argv)
* Attempt to get the pathname of the executable file.
*/
init_progfile_dir_error = init_progfile_dir(argv[0]);
if (init_progfile_dir_error != NULL)
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "fuzzshark: Can't get pathname of oss-fuzzshark program: %s.\n", init_progfile_dir_error);
g_free(init_progfile_dir_error);
}

/* Initialize the version information. */
ws_init_version_info("OSS Fuzzshark (Wireshark)", NULL,
Expand Down

0 comments on commit c22b857

Please sign in to comment.