]> granicus.if.org Git - postgresql/commitdiff
libpq: Fix memory leak in URI parser
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 24 Aug 2012 02:33:04 +0000 (22:33 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 24 Aug 2012 02:33:04 +0000 (22:33 -0400)
When an invalid query parameter is reported, some memory leaks.

found by Coverity

src/interfaces/libpq/fe-connect.c

index adaab7aaade60a980b7eaf5b6e9734444c72b930..3dcd0c3f9c09ec06144c040cc333e382b9d7f78b 100644 (file)
@@ -4879,6 +4879,11 @@ conninfo_uri_parse_params(char *params,
                                                          libpq_gettext(
                                                                        "invalid URI query parameter: \"%s\"\n"),
                                                          keyword);
+                       if (malloced)
+                       {
+                               free(keyword);
+                               free(value);
+                       }
                        return false;
                }
                if (malloced)