Code

utils dbi: Avoid segfault when executing queries when not connected.
authorSebastian Harl <sh@tokkee.org>
Tue, 19 Feb 2013 17:39:46 +0000 (18:39 +0100)
committerSebastian Harl <sh@tokkee.org>
Tue, 19 Feb 2013 17:39:46 +0000 (18:39 +0100)
Apparently, the libdbi functions don't check for that condition.

src/utils/dbi.c

index ee2280ce939e6bb9f61cdde27ba3cfa5415d5028..ea846b0006c545e1a3e25b4196cd1bc23f5b5904 100644 (file)
@@ -355,7 +355,7 @@ sdb_dbi_exec_query(sdb_dbi_client_t *client, const char *query,
 
        int status;
 
-       if ((! client) || (! query))
+       if ((! client) || (! client->conn) || (! query))
                return -1;
 
        res = dbi_conn_query(client->conn, query);