File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -399,7 +399,13 @@ char *json_encode_string(const char *str)
399
399
SB sb;
400
400
sb_init (&sb);
401
401
402
- emit_string (&sb, str);
402
+ try {
403
+ emit_string (&sb, str);
404
+ }
405
+ catch (std::exception &e) {
406
+ sb_free (&sb);
407
+ throw ;
408
+ }
403
409
404
410
return sb_finish (&sb);
405
411
}
@@ -409,10 +415,16 @@ char *json_stringify(const JsonNode *node, const char *space)
409
415
SB sb;
410
416
sb_init (&sb);
411
417
412
- if (space != NULL )
413
- emit_value_indented (&sb, node, space, 0 );
414
- else
415
- emit_value (&sb, node);
418
+ try {
419
+ if (space != NULL )
420
+ emit_value_indented (&sb, node, space, 0 );
421
+ else
422
+ emit_value (&sb, node);
423
+ }
424
+ catch (std::exception &e) {
425
+ sb_free (&sb);
426
+ throw ;
427
+ }
416
428
417
429
return sb_finish (&sb);
418
430
}
You can’t perform that action at this time.
0 commit comments