Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c9f76c100 | ||
|
|
2c9947eec9 | ||
|
|
9a85c26161 | ||
|
|
c0088e1ebe | ||
|
|
8738160e16 | ||
|
|
eb6dd6ef6b | ||
|
|
98fb2c9437 |
@@ -1,3 +1,10 @@
|
||||
1.5.1
|
||||
=====
|
||||
Fixes:
|
||||
------
|
||||
* Add gcc version guard to the Makefile (#164), thanks @juvasquezg
|
||||
* Fix incorrect free in `cJSON_Utils` if custom memory allocator is used (#166), thanks @prefetchnta
|
||||
|
||||
1.5.0
|
||||
=====
|
||||
Features:
|
||||
|
||||
@@ -7,7 +7,7 @@ project(cJSON C)
|
||||
|
||||
set(PROJECT_VERSION_MAJOR 1)
|
||||
set(PROJECT_VERSION_MINOR 5)
|
||||
set(PROJECT_VERSION_PATCH 0)
|
||||
set(PROJECT_VERSION_PATCH 1)
|
||||
set(CJSON_VERSION_SO 1)
|
||||
set(CJSON_UTILS_VERSION_SO 1)
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
@@ -17,6 +17,7 @@ Contributors
|
||||
* [IvanVoid](https://github.com/npi3pak)
|
||||
* [Jiri Zouhar](https://github.com/loigu)
|
||||
* [Jonathan Fether](https://github.com/jfether)
|
||||
* [Julián Vásquez](https://github.com/juvasquezg)
|
||||
* [Kevin Branigan](https://github.com/kbranigan)
|
||||
* [Kyle Chisholm](https://github.com/ChisholmKyle)
|
||||
* [Linus Wallgren](https://github.com/ecksun)
|
||||
@@ -26,6 +27,7 @@ Contributors
|
||||
* [Mike Robinson](https://github.com/mhrobinson)
|
||||
* Paulo Antonio Alvarez
|
||||
* [Pawel Winogrodzki](https://github.com/PawelWMS)
|
||||
* [prefetchnta](https://github.com/prefetchnta)
|
||||
* [Rafael Leal Dias](https://github.com/rafaeldias)
|
||||
* [Rod Vagg](https://github.com/rvagg)
|
||||
* [Roland Meertens](https://github.com/rmeertens)
|
||||
|
||||
14
Makefile
14
Makefile
@@ -8,7 +8,7 @@ CJSON_TEST_SRC = cJSON.c test.c
|
||||
|
||||
LDLIBS = -lm
|
||||
|
||||
LIBVERSION = 1.5.0
|
||||
LIBVERSION = 1.5.1
|
||||
CJSON_SOVERSION = 1
|
||||
UTILS_SOVERSION = 1
|
||||
|
||||
@@ -21,7 +21,17 @@ INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
|
||||
|
||||
INSTALL ?= cp -a
|
||||
|
||||
R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector-strong $(CFLAGS)
|
||||
# validate gcc version for use fstack-protector-strong
|
||||
MIN_GCC_VERSION = "4.9"
|
||||
GCC_VERSION := "`gcc -dumpversion`"
|
||||
IS_GCC_ABOVE_MIN_VERSION := $(shell expr "$(GCC_VERSION)" ">=" "$(MIN_GCC_VERSION)")
|
||||
ifeq "$(IS_GCC_ABOVE_MIN_VERSION)" "1"
|
||||
CFLAGS += -fstack-protector-strong
|
||||
else
|
||||
CFLAGS += -fstack-protector
|
||||
endif
|
||||
|
||||
R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion $(CFLAGS)
|
||||
|
||||
uname := $(shell sh -c 'uname -s 2>/dev/null || echo false')
|
||||
|
||||
|
||||
2
cJSON.c
2
cJSON.c
@@ -58,7 +58,7 @@ CJSON_PUBLIC(const char *) cJSON_GetErrorPtr(void)
|
||||
}
|
||||
|
||||
/* This is a safeguard to prevent copy-pasters from using incompatible C and header files */
|
||||
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 5) || (CJSON_VERSION_PATCH != 0)
|
||||
#if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 5) || (CJSON_VERSION_PATCH != 1)
|
||||
#error cJSON.h and cJSON.c have different versions. Make sure that both have the same.
|
||||
#endif
|
||||
|
||||
|
||||
2
cJSON.h
2
cJSON.h
@@ -31,7 +31,7 @@ extern "C"
|
||||
/* project version */
|
||||
#define CJSON_VERSION_MAJOR 1
|
||||
#define CJSON_VERSION_MINOR 5
|
||||
#define CJSON_VERSION_PATCH 0
|
||||
#define CJSON_VERSION_PATCH 1
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -1041,7 +1041,7 @@ static void compose_patch(cJSON * const patches, const unsigned char * const ope
|
||||
encode_string_as_pointer(full_path + path_length + 1, suffix);
|
||||
|
||||
cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)full_path));
|
||||
free(full_path);
|
||||
cJSON_free(full_path);
|
||||
}
|
||||
|
||||
if (value != NULL)
|
||||
@@ -1100,7 +1100,7 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
|
||||
* if size_t is an alias of unsigned long, or if it is bigger */
|
||||
if (index > ULONG_MAX)
|
||||
{
|
||||
free(new_path);
|
||||
cJSON_free(new_path);
|
||||
return;
|
||||
}
|
||||
sprintf((char*)new_path, "%s/%lu", path, (unsigned long)index); /* path of the current array element */
|
||||
@@ -1115,7 +1115,7 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
|
||||
* if size_t is an alias of unsigned long, or if it is bigger */
|
||||
if (index > ULONG_MAX)
|
||||
{
|
||||
free(new_path);
|
||||
cJSON_free(new_path);
|
||||
return;
|
||||
}
|
||||
sprintf((char*)new_path, "%lu", (unsigned long)index);
|
||||
@@ -1126,7 +1126,7 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
|
||||
{
|
||||
compose_patch(patches, (const unsigned char*)"add", path, (const unsigned char*)"-", to_child);
|
||||
}
|
||||
free(new_path);
|
||||
cJSON_free(new_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1168,7 +1168,7 @@ static void create_patches(cJSON * const patches, const unsigned char * const pa
|
||||
|
||||
/* create a patch for the element */
|
||||
create_patches(patches, new_path, from_child, to_child, case_sensitive);
|
||||
free(new_path);
|
||||
cJSON_free(new_path);
|
||||
|
||||
from_child = from_child->next;
|
||||
to_child = to_child->next;
|
||||
|
||||
Reference in New Issue
Block a user