From: Eric Haszlakiewicz Date: Fri, 3 Feb 2017 17:10:27 +0000 (+0000) Subject: Use strdup instead of strndup in test1.c, there's no need for the latter because... X-Git-Tag: json-c-0.13-20171207~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75825a9f01292f8dfe5c1aa1dc002acae738a153;p=thirdparty%2Fjson-c.git 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. --- diff --git a/tests/test1.c b/tests/test1.c index b093df74..68706cb9 100644 --- a/tests/test1.c +++ b/tests/test1.c @@ -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 {