mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Func: fix memory leaks in check_built_in_call()
All error branches leak the `fmt_str_arg->Eval(0)` return value.
This commit is contained in:
parent
6c263cbce5
commit
e32a9a61f6
1 changed files with 3 additions and 0 deletions
|
@ -828,6 +828,7 @@ bool check_built_in_call(BuiltinFunc* f, CallExpr* call)
|
||||||
|
|
||||||
if ( ! *fmt_str )
|
if ( ! *fmt_str )
|
||||||
{
|
{
|
||||||
|
Unref(fmt_str_val);
|
||||||
call->Error("format string ends with bare '%'");
|
call->Error("format string ends with bare '%'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -839,11 +840,13 @@ bool check_built_in_call(BuiltinFunc* f, CallExpr* call)
|
||||||
|
|
||||||
if ( args.length() != num_fmt + 1 )
|
if ( args.length() != num_fmt + 1 )
|
||||||
{
|
{
|
||||||
|
Unref(fmt_str_val);
|
||||||
call->Error("mismatch between format string to fmt() and number of arguments passed");
|
call->Error("mismatch between format string to fmt() and number of arguments passed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unref(fmt_str_val);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue