From: Tollef Fog Heen Date: Mon, 12 Oct 2009 06:28:44 +0000 (+0200) Subject: Plug some memory leaks X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=072d0d136055212439d11464b32cfcda7e8d17ee;p=yubikey-server-c Plug some memory leaks --- diff --git a/src/main.c b/src/main.c index 1449ea9..1c7e9cb 100644 --- a/src/main.c +++ b/src/main.c @@ -138,6 +138,7 @@ static int send_response(struct MHD_Connection *conn, MHD_YES, MHD_YES); r = MHD_queue_response(conn, MHD_HTTP_OK, response); MHD_destroy_response(response); + free(resp_text); if (r == MHD_YES) return 0; return -1; @@ -232,6 +233,7 @@ static int set_data_for_uid(char *uid, struct ykc_stats *stats) /* XXX Better error handling.*/ } assert(PQntuples(res) == 0); + PQclear(res); return 0; } @@ -274,6 +276,7 @@ static int get_data_for_uid(char *uid, struct ykc_stats *stats) tmp = PQgetvalue(res, 0, PQfnumber(res, "session_use")); stats->session_use = ntohl(*((uint32_t *) tmp)); stats->public_id = NULL; + PQclear(res); return 0; }