diff --git a/CMakeLists.txt b/CMakeLists.txt index d2c4cfd..5a2a3c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project(parson C) include (GNUInstallDirs) -set(PARSON_VERSION 1.1.1) +set(PARSON_VERSION 1.1.2) add_library(parson parson.c) target_include_directories(parson PUBLIC $) diff --git a/package.json b/package.json index 3c65ea2..07c2efb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parson", - "version": "1.1.1", + "version": "1.1.2", "repo": "kgabis/parson", "description": "Small json parser and reader", "keywords": [ "json", "parser" ], diff --git a/parson.c b/parson.c index d2b5141..535b9de 100644 --- a/parson.c +++ b/parson.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.1.1 ( http://kgabis.github.com/parson/ ) + Parson 1.1.2 ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2021 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy @@ -742,6 +742,9 @@ static JSON_Value * parse_object_value(const char **string, size_t nesting) { new_key = get_quoted_string(string, &key_len); /* We do not support key names with embedded \0 chars */ if (new_key == NULL || key_len != strlen(new_key)) { + if (new_key) { + parson_free(new_key); + } json_value_free(output_value); return NULL; } diff --git a/parson.h b/parson.h index 12cdda3..4d3acd0 100644 --- a/parson.h +++ b/parson.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: MIT - Parson 1.1.1 ( http://kgabis.github.com/parson/ ) + Parson 1.1.2 ( http://kgabis.github.com/parson/ ) Copyright (c) 2012 - 2021 Krzysztof Gabis Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/tests.c b/tests.c index e828771..e558f43 100644 --- a/tests.c +++ b/tests.c @@ -588,6 +588,8 @@ void test_memory_leaks() { TEST(json_object_set_boolean(NULL, "lorem", 0) == JSONFailure); TEST(json_object_set_null(NULL, "lorem") == JSONFailure); + TEST(json_parse_string("{\"\\u0000\"") == NULL); + TEST(malloc_count == 0); }