From: Arran Cudbard-Bell Date: Mon, 20 Jan 2020 17:34:32 +0000 (-0500) Subject: Return from fr_jason_afrom_pair_list should not be const X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4703ed82d7b86fa2c29a455d087e88e683ff7e26;p=thirdparty%2Ffreeradius-server.git Return from fr_jason_afrom_pair_list should not be const --- diff --git a/src/lib/json/base.h b/src/lib/json/base.h index 49eaaa6beac..9bf5052a966 100644 --- a/src/lib/json/base.h +++ b/src/lib/json/base.h @@ -68,5 +68,5 @@ size_t fr_json_from_pair(char *out, size_t outlen, VALUE_PAIR const *vp); void fr_json_version_print(void); -const char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const char *prefix); +char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const char *prefix); #endif diff --git a/src/lib/json/json.c b/src/lib/json/json.c index 7a49e35d8ae..65ec26459b7 100644 --- a/src/lib/json/json.c +++ b/src/lib/json/json.c @@ -364,12 +364,13 @@ void fr_json_version_print(void) * @param[in] prefix The prefix to use, can be NULL to skip the prefix. * @return JSON string representation of the value pairs */ -const char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const char *prefix) +char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const char *prefix) { fr_cursor_t cursor; VALUE_PAIR *vp; struct json_object *obj; const char *p; + char *out; char buf[FR_DICT_ATTR_MAX_NAME_LEN + 32]; MEM(obj = json_object_new_object()); @@ -445,10 +446,10 @@ const char *fr_json_afrom_pair_list(TALLOC_CTX *ctx, VALUE_PAIR **vps, const cha } MEM(p = json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)); - MEM(p = talloc_strdup(ctx, p)); + MEM(out = talloc_strdup(ctx, p)); json_object_put(obj); /* Should also free string buff from above */ - return p; + return out; }