Initialize the frame_table_size field of the private data to 0 and the

frame_table field to NULL before trying to allocate the frame table, so
that if we fail before we allocate the frame table, the attempt to free
the private data doesn't crash due to the frame_table field containing a
bogus pointer.

svn path=/trunk/; revision=49697
This commit is contained in:
Guy Harris 2013-06-02 18:09:13 +00:00
parent 05a7a45620
commit 3922276de4
1 changed files with 9 additions and 0 deletions

View File

@ -307,6 +307,15 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
netmon->version_major = hdr.ver_major;
netmon->version_minor = hdr.ver_minor;
/*
* No frame table allocated yet; initialize these in case we
* get an error before allocating it or when trying to allocate
* it, so that the attempt to release the private data on failure
* doesn't crash.
*/
netmon->frame_table_size = 0;
netmon->frame_table = NULL;
/*
* Get the offset of the frame index table.
*/