Plug a memory leak.

If the user aborted the process of exporting packets, if we're writing
to a temporary file, we unlink the file, but we don't free the
g_mallocated name of the file, so it's leaked.  Free it.
This commit is contained in:
Guy Harris 2021-05-22 12:23:50 -07:00
parent 10f36f219c
commit 54508703b0
1 changed files with 3 additions and 1 deletions

4
file.c
View File

@ -4871,8 +4871,10 @@ cf_export_specified_packets(capture_file *cf, const char *fname,
XXX - should we do so even if we're not writing to a
temporary file? */
wtap_dump_close(pdh, &err, &err_info);
if (fname_new != NULL)
if (fname_new != NULL) {
ws_unlink(fname_new);
g_free(fname_new);
}
return CF_WRITE_ABORTED;
break;