netmon: Initialize struct netmonrec_comment on alloc

This avoids an illegal pointer to free() on error.

Bug: 14397
Change-Id: Id6e535141c7a3ee7b3d1822875b571e2199a5387
Reviewed-on: https://code.wireshark.org/review/25660
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
This commit is contained in:
Stig Bjørlykke 2018-02-07 10:20:50 +01:00
parent 7ee8ead85c
commit 28960d79cc
1 changed files with 1 additions and 1 deletions

View File

@ -534,7 +534,7 @@ wtap_open_return_val netmon_open(wtap *wth, int *err, gchar **err_info)
return WTAP_OPEN_ERROR;
}
comment_rec = g_new(struct netmonrec_comment, 1);
comment_rec = g_new0(struct netmonrec_comment, 1);
comment_rec->numFramePerComment = pletoh32(&comment_header.numFramePerComment);
comment_rec->frameOffset = pletoh32(&comment_header.frameOffset);
comment_rec->titleLength = pletoh32(&comment_header.titleLength);