[libsoup] Fix some leaks in the error cases of soup_multipart_new_from_message()



commit 483ab463738f9462bcb2ca38d5dc6439f682d72b
Author: Dan Winship <danw gnome org>
Date:   Mon Aug 24 12:30:49 2009 -0400

    Fix some leaks in the error cases of soup_multipart_new_from_message()
    
    Noticed by Xan Lopez while looking for a different leak.

 libsoup/soup-multipart.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index 50b3549..67f0e9c 100644
--- a/libsoup/soup-multipart.c
+++ b/libsoup/soup-multipart.c
@@ -162,6 +162,7 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers,
 	start = find_boundary (flattened->data, boundary, boundary_len);
 	if (!start) {
 		soup_multipart_free (multipart);
+		soup_buffer_free (flattened);
 		return NULL;
 	}
 
@@ -169,12 +170,14 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers,
 		end = find_boundary (start + 2 + boundary_len, boundary, boundary_len);
 		if (!end) {
 			soup_multipart_free (multipart);
+			soup_buffer_free (flattened);
 			return NULL;
 		}
 
 		split = strstr (start, "\r\n\r\n");
 		if (!split || split > end) {
 			soup_multipart_free (multipart);
+			soup_buffer_free (flattened);
 			return NULL;
 		}
 		split += 4;
@@ -193,6 +196,7 @@ soup_multipart_new_from_message (SoupMessageHeaders *headers,
 		if (!soup_headers_parse (start, split - 2 - start,
 					 part_headers)) {
 			soup_multipart_free (multipart);
+			soup_buffer_free (flattened);
 			return NULL;
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]