aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index ae85db9dd5a..3e9c45bc406 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -4931,7 +4931,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
{
int prefix_len;
char *p;
- char *buf;
+ char *buf = NULL;
char *start;
char prevchar = '\0';
char *user = NULL;
@@ -4946,7 +4946,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
{
printfPQExpBuffer(errorMessage,
libpq_gettext("out of memory\n"));
- return false;
+ goto cleanup;
}
/* need a modifiable copy of the input URI */
@@ -4955,7 +4955,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
{
printfPQExpBuffer(errorMessage,
libpq_gettext("out of memory\n"));
- return false;
+ goto cleanup;
}
start = buf;
@@ -5156,7 +5156,8 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri,
cleanup:
termPQExpBuffer(&hostbuf);
termPQExpBuffer(&portbuf);
- free(buf);
+ if (buf)
+ free(buf);
return retval;
}