Skip to content

Commit

Permalink
Fix a leak when generating an error message about non-string key
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonid S. Usov committed Oct 23, 2018
1 parent 11ce091 commit eda80f2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static jv check_object_key(block k) {
char errbuf[15];
return jv_string_fmt("Cannot use %s (%s) as object key",
jv_kind_name(block_const_kind(k)),
jv_dump_string_trunc(jv_copy(block_const(k)), errbuf, sizeof(errbuf)));
jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf)));
}
return jv_invalid();
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static jv check_object_key(block k) {
char errbuf[15];
return jv_string_fmt("Cannot use %s (%s) as object key",
jv_kind_name(block_const_kind(k)),
jv_dump_string_trunc(jv_copy(block_const(k)), errbuf, sizeof(errbuf)));
jv_dump_string_trunc(block_const(k), errbuf, sizeof(errbuf)));
}
return jv_invalid();
}
Expand Down

0 comments on commit eda80f2

Please # to comment.