Fix memory leak in ecpglib's connect function.
authorMichael Meskes <meskes@postgresql.org>
Mon, 15 Jun 2015 12:20:09 +0000 (14:20 +0200)
committerMichael Meskes <meskes@postgresql.org>
Mon, 15 Jun 2015 12:23:17 +0000 (14:23 +0200)
Patch by Michael Paquier

src/interfaces/ecpg/ecpglib/connect.c

index 4f5541308e53797b1e0da74810990f0434f3ab2c..d255c5d8f885caddab514b6b8d83cf198569759d 100644 (file)
@@ -320,7 +320,10 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
    }
 
    if ((this = (struct connection *) ecpg_alloc(sizeof(struct connection), lineno)) == NULL)
+   {
+       ecpg_free(dbname);
        return false;
+   }
 
    if (dbname != NULL)
    {