提交 d4318483 编写于 作者: P Peter Eisentraut

libpq: Fix minor memory leaks

When using connection info arrays with a conninfo string in the dbname
slot, some memory would be leaked if an error occurred while
processing the following array slots.

found by Coverity
上级 598bb8cd
......@@ -4303,6 +4303,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
{
printfPQExpBuffer(errorMessage,
libpq_gettext("out of memory\n"));
PQconninfoFree(str_options);
return NULL;
}
memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions));
......@@ -4330,6 +4331,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
libpq_gettext("invalid connection option \"%s\"\n"),
pname);
PQconninfoFree(options);
PQconninfoFree(str_options);
return NULL;
}
......@@ -4374,6 +4376,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
printfPQExpBuffer(errorMessage,
libpq_gettext("out of memory\n"));
PQconninfoFree(options);
PQconninfoFree(str_options);
return NULL;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册