]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
postgresql: add sanity checking
authorEric Leblond <eric@regit.org>
Sun, 17 Mar 2013 20:43:51 +0000 (21:43 +0100)
committerEric Leblond <eric@regit.org>
Sat, 20 Apr 2013 09:36:45 +0000 (11:36 +0200)
Clean postgresql handler at deinit.

output/pgsql/ulogd_output_PGSQL.c

index f246153d5c6c17385e6ceaa8e6912f92685ab17d..88fb7654659393664a027e34c095238e3887f160 100644 (file)
@@ -214,7 +214,9 @@ static int close_db_pgsql(struct ulogd_pluginstance *upi)
 {
        struct pgsql_instance *pi = (struct pgsql_instance *) upi->private;
 
-       PQfinish(pi->dbh);
+       if (pi->dbh)
+               PQfinish(pi->dbh);
+       pi->dbh = NULL;
 
        return 0;
 }