]> granicus.if.org Git - postgresql/commitdiff
psql: Fix memory leak
authorPeter Eisentraut <peter_e@gmx.net>
Mon, 16 Jan 2012 18:08:33 +0000 (20:08 +0200)
committerPeter Eisentraut <peter_e@gmx.net>
Mon, 16 Jan 2012 18:08:33 +0000 (20:08 +0200)
The command

\password username

leaked memory.

src/bin/psql/command.c

index 69fac83cd58275e735be6e09d133dca1e1a683cf..6c3f0aa69d6e6b265bbea7f85912ad51214273d0 100644 (file)
@@ -953,6 +953,9 @@ exec_command(const char *cmd,
                                        PQclear(res);
                                PQfreemem(encrypted_password);
                        }
+
+                       if (opt0)
+                               free(opt0);
                }
 
                free(pw1);