mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Fix leaked String and Variant in harnessPqScriptRun().
This commit is contained in:
parent
ceb303f9e2
commit
8047e97e31
@ -73,14 +73,24 @@ harnessPqScriptStrictSet(bool strict)
|
|||||||
Run pq script
|
Run pq script
|
||||||
***********************************************************************************************************************************/
|
***********************************************************************************************************************************/
|
||||||
static HarnessPq *
|
static HarnessPq *
|
||||||
harnessPqScriptRun(const char *function, const VariantList *param, HarnessPq *parent)
|
harnessPqScriptRun(const char *const function, const VariantList *const param, const HarnessPq *const parent)
|
||||||
{
|
{
|
||||||
// If an error has already been thrown then throw the same error again
|
// If an error has already been thrown then throw the same error again
|
||||||
if (harnessPqScriptFail)
|
if (harnessPqScriptFail)
|
||||||
THROW(AssertError, harnessPqScriptError);
|
THROW(AssertError, harnessPqScriptError);
|
||||||
|
|
||||||
// Convert params to json for comparison and reporting
|
// Convert params to json for comparison and reporting
|
||||||
String *paramStr = param ? jsonFromVar(varNewVarLst(param)) : strNew();
|
String *paramStr = NULL;
|
||||||
|
|
||||||
|
if (param)
|
||||||
|
{
|
||||||
|
Variant *const varList = varNewVarLst(param);
|
||||||
|
|
||||||
|
paramStr = jsonFromVar(varList);
|
||||||
|
varFree(varList);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
paramStr = strNew();
|
||||||
|
|
||||||
// Ensure script has not ended
|
// Ensure script has not ended
|
||||||
if (harnessPqScriptDone)
|
if (harnessPqScriptDone)
|
||||||
@ -151,6 +161,8 @@ harnessPqScriptRun(const char *function, const VariantList *param, HarnessPq *pa
|
|||||||
if (harnessPqScript[harnessPqScriptIdx].function == NULL)
|
if (harnessPqScript[harnessPqScriptIdx].function == NULL)
|
||||||
harnessPqScriptDone = true;
|
harnessPqScriptDone = true;
|
||||||
|
|
||||||
|
strFree(paramStr);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user