summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/db.c b/db.c
index a968f28..e3764d8 100644
--- a/db.c
+++ b/db.c
@@ -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
+}