aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-02-21 14:28:57 +0100
committerDario Lombardo <lomato@gmail.com>2017-02-28 14:56:36 +0000
commit146b6b824da171f457198797def5083d2fa90a0c (patch)
treecfe692a1fa97b412d8d66685f14bb15aa8f71386 /text2pcap.c
parent26e62dfad07a02efc03e4c08c3c6b08e5c5d2076 (diff)
text2pcap: free memory on exit.
Make also text2pcap_lex_destroy() public to be called from main. Change-Id: I360c3dd3991d027afe6e4542ea5f9680e92f92cf Reviewed-on: https://code.wireshark.org/review/20226 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com>
Diffstat (limited to 'text2pcap.c')
-rw-r--r--text2pcap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/text2pcap.c b/text2pcap.c
index 851cb299b3..dd58e722db 100644
--- a/text2pcap.c
+++ b/text2pcap.c
@@ -236,10 +236,10 @@ static struct tm timecode_default;
static guint8* pkt_lnstart;
/* Input file */
-static const char *input_filename;
+static char *input_filename;
static FILE *input_file = NULL;
/* Output file */
-static const char *output_filename;
+static char *output_filename;
static FILE *output_file = NULL;
/* Offset base to parse */
@@ -1779,7 +1779,7 @@ parse_options (int argc, char *argv[])
}
if (strcmp(argv[optind], "-") != 0) {
- input_filename = g_strdup(argv[optind]);
+ input_filename = argv[optind];
input_file = ws_fopen(input_filename, "rb");
if (!input_file) {
fprintf(stderr, "Cannot open file [%s] for reading: %s\n",
@@ -1793,7 +1793,7 @@ parse_options (int argc, char *argv[])
if (strcmp(argv[optind+1], "-") != 0) {
/* Write to a file. Open the file, in binary mode. */
- output_filename = g_strdup(argv[optind+1]);
+ output_filename = argv[optind+1];
output_file = ws_fopen(output_filename, "wb");
if (!output_file) {
fprintf(stderr, "Cannot open file [%s] for writing: %s\n",
@@ -1915,6 +1915,7 @@ main(int argc, char *argv[])
bytes_written, (bytes_written == 1) ? "" : "s");
}
clean_exit:
+ text2pcap_lex_destroy();
fclose(input_file);
fclose(output_file);
return ret;