[PATCH] plug a nasty leak and 3 others like it

Jim Meyering jim at meyering.net
Tue Sep 28 13:17:28 UTC 2010



>From 2214d5b9c6adb68baabcaffabc73dd02239096b1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Tue, 28 Sep 2010 15:12:33 +0200
Subject: [PATCH] plug a nasty leak and 3 others like it

* rest.c (proxy_update_prov): Don't leak the state buffer
allocated in access_handler.  I confirmed that this does plug
an actual leak.
(proxy_query, proxy_bucket_post, proxy_object_post):
These are in the same vein, but were fixed by inspection,
since tests don't yet exercise these.
---
 rest.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/rest.c b/rest.c
index 475adc1..a2fffc3 100644
--- a/rest.c
+++ b/rest.c
@@ -825,6 +825,7 @@ proxy_query (void *cctx, struct MHD_Connection *conn, const char *url,
 		MHD_add_response_header(resp,"Content-Type","text/xml");
 		MHD_queue_response(conn,MHD_HTTP_OK,resp);
 		MHD_destroy_response(resp);
+		free_ms(ms);
 	}

 	return MHD_YES;
@@ -1191,6 +1192,7 @@ proxy_bucket_post (void *cctx, struct MHD_Connection *conn, const char *url,
 		}
 		MHD_queue_response(conn,rc,resp);
 		MHD_destroy_response(resp);
+		free_ms(ms);
 	}

 	return MHD_YES;
@@ -1308,6 +1310,7 @@ proxy_object_post (void *cctx, struct MHD_Connection *conn, const char *url,
 		}
 		MHD_queue_response(conn,rc,resp);
 		MHD_destroy_response(resp);
+		free_ms(ms);
 	}

 	return MHD_YES;
@@ -1471,6 +1474,7 @@ proxy_update_prov (void *cctx, struct MHD_Connection *conn, const char *url,
 		}
 		MHD_queue_response(conn,rc,resp);
 		MHD_destroy_response(resp);
+		free_ms(ms);
 	}

 	return MHD_YES;
--
1.7.3.293.gca9a76


More information about the iwhd-devel mailing list