From 05b43fc5af805dde1bdbf74dd1448690f3a10705 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 18 Dec 2018 22:58:24 -0800 Subject: Clean up exp_pdu_open() API. It really shouldn't free the comment passed to it, as the caller allocated it, and knows how to free it if necessary; it might not even have been allocated. Make the comment argument a "const char *" to 1) allow passing string constants etc. and 2) to catch any attempts to free it in exp_pdu_open(). Make the callers free it after exp_pdu_open() returns. (Alternatively, we could have exp_pdu_open() take the file name argument and generate the comment itself, so that all code paths generate the same comment.) Change-Id: I6e6924b05565761b641a6c3b4d9a2e97f4264e1b Ping-Bug: 15365 Reviewed-on: https://code.wireshark.org/review/31105 Reviewed-by: Guy Harris --- ui/tap_export_pdu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui/tap_export_pdu.c') diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 25232f0452..d3302a5aca 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -82,7 +82,7 @@ export_pdu_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const } int -exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) +exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, const char *comment) { int err; @@ -103,7 +103,6 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, char *comment) /* options */ wtap_block_add_string_option(shb_hdr, OPT_COMMENT, comment, strlen(comment)); - g_free(comment); /* * UTF-8 string containing the name of the operating system used to create -- cgit v1.2.3