Skip to content

Commit

Permalink
Use strdup instead of strndup in test1.c, there's no need for the lat…
Browse files Browse the repository at this point in the history
…ter because json_object_to_json_string_length() will always return a properly sized string.
  • Loading branch information
hawicz committed Feb 3, 2017
1 parent 8157784 commit 75825a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 75825a9

Please sign in to comment.