Fix memory leak on module command call

If a module command outputted JSON, the string generated by json_dumps
would leak.
This commit is contained in:
Markus Mäkelä 2017-09-28 13:11:49 +03:00
parent e55968b808
commit 380482d507

View File

@ -1709,7 +1709,9 @@ static void callModuleCommand(DCB *dcb, char *domain, char *id, char *v3,
}
else if (output)
{
dcb_printf(dcb, "%s\n", json_dumps(output, JSON_INDENT(4)));
char* js = json_dumps(output, JSON_INDENT(4));
dcb_printf(dcb, "%s\n", js);
MXS_FREE(js);
}
json_decref(output);