aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-05-22 12:23:50 -0700
committerGuy Harris <gharris@sonic.net>2021-05-22 12:23:50 -0700
commit54508703b0ac4d85df4104f6114a247d68c42b8e (patch)
tree2156fff928aa3a181409a56b5549a6311f52ff8a
parent10f36f219c46342af6399ea6e0d8106910b3e8f0 (diff)
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.
-rw-r--r--file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/file.c b/file.c
index 1e0b28e661..7227eebc4c 100644
--- a/file.c
+++ b/file.c
@@ -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;