diff options
author | Michael Mann <mmann78@netscape.net> | 2016-05-19 22:28:43 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-05-22 23:39:14 +0000 |
commit | 81d65ccec65c9bbe972fcb64933fc34d9679562c (patch) | |
tree | c84fcfbb3befcd535b470310a8d8cf48b63dfc1e /wiretap/lanalyzer.c | |
parent | 6a992182ce47d721ce73eabf99983cea480dcf97 (diff) |
Add wtap_optionblock_set_option_string_format
Also add a length parameter to wtap_optionblock_set_option_string
Change-Id: I8c7bbc48aa96b5c2a91ab9a17980928d6894f1ee
Reviewed-on: https://code.wireshark.org/review/15505
Reviewed-by: Anthony Coddington <anthony.coddington@endace.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'wiretap/lanalyzer.c')
-rw-r--r-- | wiretap/lanalyzer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 72ebba82e3..eb4ad3815e 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -323,12 +323,15 @@ wtap_open_return_val lanalyzer_open(wtap *wth, int *err, gchar **err_info) comment = (char *)g_malloc(record_length + 1); if (!wtap_read_bytes(wth->fh, comment, record_length, err, err_info)) { - if (*err != WTAP_ERR_SHORT_READ) - return WTAP_OPEN_ERROR; + if (*err != WTAP_ERR_SHORT_READ) { + g_free(comment); + return WTAP_OPEN_ERROR; + } + g_free(comment); return WTAP_OPEN_NOT_MINE; } - comment[record_length] = '\0'; - wtap_optionblock_set_option_string(wth->shb_hdr, OPT_COMMENT, comment); + wtap_optionblock_set_option_string(wth->shb_hdr, OPT_COMMENT, comment, record_length); + g_free(comment); } /* If we made it this far, then the file is a LANAlyzer file. |