Permalink
Browse files

Fix #433, memory leak in json resultset processing

  • Loading branch information...
klirichek committed Sep 3, 2018
1 parent e78e9c9 commit 94bc6fcbdae4d08bcf6da2966e3ec2966091289f
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/sphinxjsonquery.cpp
@@ -1938,14 +1938,12 @@ CSphString sphEncodeResultJson ( const AggrResult_t & tRes, const CSphQuery & tQ
if ( pProfile )
{
cJSON * pProfileMeta = cJSON_CreateObject();
assert ( pProfileMeta );
cJSON * pProfileResult = pProfile->LeakResultAsJson();
// FIXME: result can be empty if we run a fullscan
if ( pProfileResult )
{
cJSON * pProfileMeta = cJSON_CreateObject ();
assert ( pProfileMeta );
assert ( cJSON_IsObject ( pProfileResult ) );
cJSON_AddItemToObject ( pProfileMeta, "query", pProfileResult );
cJSON_AddItemToObject ( pRoot, "profile", pProfileMeta );

0 comments on commit 94bc6fc

Please sign in to comment.