Fossil SCM
Replaced a malloc()/free() with fossil_malloc()/free() and removed the corresponding NULL check (fossil_malloc() dies on error).
Commit
6ad70288d9f49a5e59128a3a5ea99a6125a03d67
Parent
5f3a0681a0e403a…
1 file changed
+2
-3
+2
-3
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -932,12 +932,11 @@ | ||
| 932 | 932 | element. */ |
| 933 | 933 | cson_value * part = NULL; |
| 934 | 934 | char * zPart = NULL; |
| 935 | 935 | ++rc; |
| 936 | 936 | assert( head != p ); |
| 937 | - zPart = (char*)malloc(len+1); | |
| 938 | - assert( (zPart != NULL) && "malloc failure" ); | |
| 937 | + zPart = (char*)fossil_malloc(len+1); | |
| 939 | 938 | memcpy(zPart, head, len); |
| 940 | 939 | zPart[len] = 0; |
| 941 | 940 | if(doDeHttp){ |
| 942 | 941 | dehttpize(zPart); |
| 943 | 942 | } |
| @@ -957,11 +956,11 @@ | ||
| 957 | 956 | run before some of the fossil/json bits are initialized, |
| 958 | 957 | and fossil_panic() calls into the JSON API. |
| 959 | 958 | */ |
| 960 | 959 | ; |
| 961 | 960 | } |
| 962 | - free(zPart); | |
| 961 | + fossil_free(zPart); | |
| 963 | 962 | len = 0; |
| 964 | 963 | } |
| 965 | 964 | if( !*p ){ |
| 966 | 965 | break; |
| 967 | 966 | } |
| 968 | 967 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -932,12 +932,11 @@ | |
| 932 | element. */ |
| 933 | cson_value * part = NULL; |
| 934 | char * zPart = NULL; |
| 935 | ++rc; |
| 936 | assert( head != p ); |
| 937 | zPart = (char*)malloc(len+1); |
| 938 | assert( (zPart != NULL) && "malloc failure" ); |
| 939 | memcpy(zPart, head, len); |
| 940 | zPart[len] = 0; |
| 941 | if(doDeHttp){ |
| 942 | dehttpize(zPart); |
| 943 | } |
| @@ -957,11 +956,11 @@ | |
| 957 | run before some of the fossil/json bits are initialized, |
| 958 | and fossil_panic() calls into the JSON API. |
| 959 | */ |
| 960 | ; |
| 961 | } |
| 962 | free(zPart); |
| 963 | len = 0; |
| 964 | } |
| 965 | if( !*p ){ |
| 966 | break; |
| 967 | } |
| 968 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -932,12 +932,11 @@ | |
| 932 | element. */ |
| 933 | cson_value * part = NULL; |
| 934 | char * zPart = NULL; |
| 935 | ++rc; |
| 936 | assert( head != p ); |
| 937 | zPart = (char*)fossil_malloc(len+1); |
| 938 | memcpy(zPart, head, len); |
| 939 | zPart[len] = 0; |
| 940 | if(doDeHttp){ |
| 941 | dehttpize(zPart); |
| 942 | } |
| @@ -957,11 +956,11 @@ | |
| 956 | run before some of the fossil/json bits are initialized, |
| 957 | and fossil_panic() calls into the JSON API. |
| 958 | */ |
| 959 | ; |
| 960 | } |
| 961 | fossil_free(zPart); |
| 962 | len = 0; |
| 963 | } |
| 964 | if( !*p ){ |
| 965 | break; |
| 966 | } |
| 967 |