From 603b4d43486e6ecf06f93182a4bbee2b9678a9cb Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Wed, 14 Mar 2012 01:08:09 +0000 Subject: Don't free idb_inf in wtap_dump_open_ng(): free it in the callers. This fixes the double-free editcap crashes that the buildbot's been seeing lately. svn path=/trunk/; revision=41542 --- editcap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'editcap.c') diff --git a/editcap.c b/editcap.c index 3d75f4281b..1837a0e736 100644 --- a/editcap.c +++ b/editcap.c @@ -1155,11 +1155,15 @@ main(int argc, char *argv[]) pdh = wtap_dump_open_ng(filename, out_file_type, out_frame_type, snaplen ? MIN(snaplen, wtap_snapshot_length(wth)) : wtap_snapshot_length(wth), FALSE /* compressed */, shb_hdr, idb_inf, &err); + if (pdh == NULL) { fprintf(stderr, "editcap: Can't open or create %s: %s\n", filename, wtap_strerror(err)); exit(2); } + + g_free(idb_inf); + idb_inf = NULL; } g_assert(filename); @@ -1522,7 +1526,6 @@ main(int argc, char *argv[]) exit(2); } - g_free(idb_inf); g_free(shb_hdr); g_free(filename); } -- cgit v1.2.3