diff options
-rw-r--r-- | db.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -58,7 +58,7 @@ int db_connect(Config *c) { c->db_pass ); db = PQconnectdb(connection_string); - + free(connection_string); if (PQstatus(db) != CONNECTION_OK) { char *template = "Connection to database failed: %s\n"; char *message = PQerrorMessage(db); @@ -66,8 +66,10 @@ int db_connect(Config *c) { sprintf(error, template, message); write_log(error); clean_db(); + free(error); return 0; } + return 1; } @@ -109,4 +111,4 @@ char *get_quote(Config *c) { } return today_quote; } -}
\ No newline at end of file +} |