summaryrefslogtreecommitdiff
path: root/upb/json/printer.c
diff options
context:
space:
mode:
Diffstat (limited to 'upb/json/printer.c')
-rw-r--r--upb/json/printer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/upb/json/printer.c b/upb/json/printer.c
index c3d9bb4..0db7b80 100644
--- a/upb/json/printer.c
+++ b/upb/json/printer.c
@@ -47,9 +47,11 @@ void freestrpc(void *ptr) {
strpc *newstrpc(upb_handlers *h, const upb_fielddef *f) {
/* TODO(haberman): handle malloc failure. */
strpc *ret = malloc(sizeof(*ret));
+ size_t len;
ret->len = upb_fielddef_getjsonname(f, NULL, 0);
ret->ptr = malloc(ret->len);
- upb_fielddef_getjsonname(f, ret->ptr, ret->len);
+ len = upb_fielddef_getjsonname(f, ret->ptr, ret->len);
+ UPB_ASSERT_VAR(len, len == ret->len);
ret->len--; /* NULL */
upb_handlers_addcleanup(h, ret, freestrpc);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback