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
This commit is contained in:
parent
598bb8cdbd
commit
d4318483e1
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user