uat: fix memleak after parsing and on errors
authorPeter Wu <peter@lekensteyn.nl>
Thu, 1 Sep 2016 00:04:31 +0000 (02:04 +0200)
committerPeter Wu <peter@lekensteyn.nl>
Thu, 1 Sep 2016 21:11:51 +0000 (21:11 +0000)
commit80181532b62c19521c658f3bb281e4956797a51c
tree7a520a845223acec3e1ea4348bf1472ccfe7c4c7
parent27164ddc5bf3a9af17689732bb2562ec82a9ea73
uat: fix memleak after parsing and on errors

Memleaks could occur in these scenarios:
 - Two consecutive fields fail in their chk callback, overwriting the
   first heap-allocated error message.
 - After parsing one record, the internal record was never freed.
 - Syntax errors abort the parsing process and leaks the record and
   current field value.

These leaks will only happen at startup, when the UAT files are read or
when UAT strings are loaded (e.g. from the ssl.keys_list preference).

Change-Id: I4cf7cbc8131f71493ba70916a8f60168e5d65148
Reviewed-on: https://code.wireshark.org/review/17432
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
epan/uat_load.l