forked from osmocom/wireshark
wsutil: fix json-glib memleaks and warning
Fix memleaks and complaint when trying to load non-JSON file as JSON: "GError set over the top of a previous GError or uninitialized memory." Change-Id: If5ab04dbb757636f66130bf1f8de1a45748bf541 Fixes: v2.9.0rc0-276-g73a1e98f4e ("wsutil: use json-glib instead of jsmn if present.") Reviewed-on: https://code.wireshark.org/review/27469 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo <lomato@gmail.com>
This commit is contained in:
parent
a2376d27d7
commit
5fa2719a7d
|
@ -29,8 +29,8 @@ gboolean wsjson_is_valid_json(const guint8* buf, const size_t len)
|
|||
gboolean ret = TRUE;
|
||||
#ifdef HAVE_JSONGLIB
|
||||
JsonParser *parser = json_parser_new();
|
||||
GError* error;
|
||||
ret = json_parser_load_from_data(parser, buf, len, &error);
|
||||
ret = json_parser_load_from_data(parser, buf, len, NULL);
|
||||
g_object_unref(parser);
|
||||
#else
|
||||
/* We expect no more than 1024 tokens */
|
||||
guint max_tokens = 1024;
|
||||
|
|
Loading…
Reference in New Issue