aboutsummaryrefslogtreecommitdiffhomepage
path: root/json.c
diff options
context:
space:
mode:
authorGravatar Anthony <aj@erisian.com.au>2010-04-20 08:55:31 -0700
committerGravatar Carl Worth <cworth@cworth.org>2010-04-20 08:55:31 -0700
commit55d06f3e0bc12c27879bba98153d70ea399ec737 (patch)
tree9b28725700216320add062607f3fafe80f255803 /json.c
parentcacefbf3d6dd5bce0b60b3cdfce29bfa371dfaea (diff)
json_quote_chararray: Always return a newly talloced array
The special case for len==0 was wrong---the normal code path is to talloc to get a newly allocated, editable string, that might be talloc_free'd later. It makes more sense just to let the len==0 behaviour fall through into the normal case code. Reviewed-by: Carl Worth <cworth@cworth.org> This results in the same value being returned, but with the proper memory handling.
Diffstat (limited to 'json.c')
-rw-r--r--json.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/json.c b/json.c
index 3fd923ca..817fc83a 100644
--- a/json.c
+++ b/json.c
@@ -57,9 +57,6 @@ json_quote_chararray(const void *ctx, const char *str, const size_t len)
size_t loop;
size_t required;
- if (len == 0)
- return (char *)"\"\"";
-
for (loop = 0, required = 0, ptr = str;
loop < len;
loop++, required++, ptr++) {