From be161ba4606520542e562477d15bc71ca111ed95 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 30 May 2008 02:44:02 +0000 Subject: [PATCH] Free up the err_info string returned by wtap_read() and wtap_seek_read(). Clean up indentation. svn path=/trunk/; revision=25400 --- capinfos.c | 1 + editcap.c | 1 + file.c | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/capinfos.c b/capinfos.c index f6cf17baeb..d260d132c3 100644 --- a/capinfos.c +++ b/capinfos.c @@ -167,6 +167,7 @@ process_cap_file(wtap *wth, const char *filename) case WTAP_ERR_UNSUPPORTED_ENCAP: case WTAP_ERR_BAD_RECORD: fprintf(stderr, "(%s)\n", err_info); + g_free(err_info); break; } return 1; diff --git a/editcap.c b/editcap.c index 56a33ae4fd..8628c50e35 100644 --- a/editcap.c +++ b/editcap.c @@ -814,6 +814,7 @@ main(int argc, char *argv[]) case WTAP_ERR_UNSUPPORTED_ENCAP: case WTAP_ERR_BAD_RECORD: fprintf(stderr, "(%s)\n", err_info); + g_free(err_info); break; } } diff --git a/file.c b/file.c index 4350c3702d..ed9c458e06 100644 --- a/file.c +++ b/file.c @@ -3794,15 +3794,17 @@ cf_read_error_message(int err, const gchar *err_info) switch (err) { case WTAP_ERR_UNSUPPORTED_ENCAP: - g_snprintf(errmsg_errno, sizeof(errmsg_errno), + g_snprintf(errmsg_errno, sizeof(errmsg_errno), "The file \"%%s\" has a packet with a network type that Wireshark doesn't support.\n(%s)", err_info); - break; + g_free(err_info); + break; case WTAP_ERR_BAD_RECORD: g_snprintf(errmsg_errno, sizeof(errmsg_errno), "An error occurred while reading from the file \"%%s\": %s.\n(%s)", wtap_strerror(err), err_info); + g_free(err_info); break; default: