From af5ecc1cf814e88039eab0826a926c6b7afb0c28 Mon Sep 17 00:00:00 2001 From: bargepole Date: Mon, 2 Sep 2019 11:01:19 +0100 Subject: free for mallocs in db --- db.c | 6 ++++-- 1 file 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 +} -- cgit v1.2.3