Fix json_loadf and json_loadfd with empty input

Nothing was appended to strbuffer, so the buffer was left empty. An
empty strbuffer is not an empty string but NULL, so the result was a
segfault.

This patch fixes the problem by initializing strbuffer to an empty
string.
This commit is contained in:
Petri Lehtinen
2009-06-22 21:09:25 +03:00
parent dc9b954b62
commit b1fe723a7f
4 changed files with 22 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ typedef struct {
int size;
} strbuffer_t;
void strbuffer_init(strbuffer_t *strbuff);
int strbuffer_init(strbuffer_t *strbuff);
void strbuffer_close(strbuffer_t *strbuff);
const char *strbuffer_value(strbuffer_t *strbuff);