Skip to content

Commit d431848

Browse files
committed
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
1 parent 598bb8c commit d431848

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4303,6 +4303,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
43034303
{
43044304
printfPQExpBuffer(errorMessage,
43054305
libpq_gettext("out of memory\n"));
4306+
PQconninfoFree(str_options);
43064307
return NULL;
43074308
}
43084309
memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions));
@@ -4330,6 +4331,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
43304331
libpq_gettext("invalid connection option \"%s\"\n"),
43314332
pname);
43324333
PQconninfoFree(options);
4334+
PQconninfoFree(str_options);
43334335
return NULL;
43344336
}
43354337

@@ -4374,6 +4376,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values,
43744376
printfPQExpBuffer(errorMessage,
43754377
libpq_gettext("out of memory\n"));
43764378
PQconninfoFree(options);
4379+
PQconninfoFree(str_options);
43774380
return NULL;
43784381
}
43794382
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy