]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Return from fr_jason_afrom_pair_list should not be const
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 20 Jan 2020 17:34:32 +0000 (12:34 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 20 Jan 2020 17:34:45 +0000 (12:34 -0500)
src/lib/json/base.h
src/lib/json/json.c

index 49eaaa6beac85358c4946ef0d3cc55dc2a0cbde5..9bf5052a966d8d4c94d709e0a95730639744d58b 100644 (file)
@@ -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
index 7a49e35d8ae32feca13aa3373d5e208ca24635f7..65ec26459b72a5dd8e32eefe544951a966a2f58d 100644 (file)
@@ -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;
 }