mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
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.
This commit is contained in:
parent
cacefbf3d6
commit
55d06f3e0b
1 changed files with 0 additions and 3 deletions
3
json.c
3
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++) {
|
||||
|
|
Loading…
Reference in a new issue