Bugfix: don’t free the old json_output, the caller does that
This commit is contained in:
parent
95416175cd
commit
cd1add1f3c
|
@ -81,13 +81,13 @@ int cmdyywrap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *parse_cmd(const char *new) {
|
char *parse_cmd(const char *new) {
|
||||||
|
json_output = NULL;
|
||||||
LOG("COMMAND: *%s*\n", new);
|
LOG("COMMAND: *%s*\n", new);
|
||||||
cmdyy_scan_string(new);
|
cmdyy_scan_string(new);
|
||||||
|
|
||||||
match_init(¤t_match);
|
match_init(¤t_match);
|
||||||
context = scalloc(sizeof(struct context));
|
context = scalloc(sizeof(struct context));
|
||||||
context->filename = "cmd";
|
context->filename = "cmd";
|
||||||
FREE(json_output);
|
|
||||||
if (cmdyyparse() != 0) {
|
if (cmdyyparse() != 0) {
|
||||||
fprintf(stderr, "Could not parse command\n");
|
fprintf(stderr, "Could not parse command\n");
|
||||||
asprintf(&json_output, "{\"success\":false, \"error\":\"%s at position %d\"}",
|
asprintf(&json_output, "{\"success\":false, \"error\":\"%s at position %d\"}",
|
||||||
|
|
Loading…
Reference in New Issue