Browse Source

Use strdup instead of strndup in test1.c, there's no need for the latter because json_object_to_json_string_length() will always return a properly sized string.

tags/json-c-0.13-20171207
Eric Haszlakiewicz 8 years ago
parent
commit
75825a9f01
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      tests/test1.c

+ 1
- 1
tests/test1.c View File

@@ -35,7 +35,7 @@ static const char *to_json_string(json_object *obj, int flags)
const char *result;

result = json_object_to_json_string_length(obj, flags, &length);
copy = strndup(result, length);
copy = strdup(result);
if (copy == NULL)
printf("to_json_string: Allocation failed!\n");
else {


Loading…
Cancel
Save