]> err.no Git - yubikey-server-c/commitdiff
Plug some memory leaks
authorTollef Fog Heen <tfheen@err.no>
Mon, 12 Oct 2009 06:28:44 +0000 (08:28 +0200)
committerTollef Fog Heen <tfheen@err.no>
Mon, 12 Oct 2009 06:28:44 +0000 (08:28 +0200)
src/main.c

index 1449ea94f1e785fa61ebd44f10861703e649e897..1c7e9cb8831faa79a3ef423d213882448f1453b1 100644 (file)
@@ -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;
 }