A fix for a small memory leak in http.c's evhttp_handle_chunked_read.

Thanks,

Elliot

diff -Naur libevent-1.3b_orig/http.c libevent-1.3b_modified/http.c
--- libevent-1.3b_orig/http.c   2007-03-03 20:05:04.000000000 -0800
+++ libevent-1.3b_modified/http.c       2007-07-26 11:46:33.000000000 -0700
@@ -640,8 +640,10 @@
                       if (p == NULL)
                               break;
                       /* the last chunk is on a new line? */
-                       if (strlen(p) == 0)
+                       if (strlen(p) == 0) {
+                               free(p);
                               continue;
+                       }
                       req->ntoread = strtol(p, &endp, 16);
                       error = *p == '\0' || (*endp != '\0' && *endp != ' ');
                       free(p);

diff -Naur libevent-1.3b_orig/http.c libevent-1.3b_modified/http.c
--- libevent-1.3b_orig/http.c	2007-03-03 20:05:04.000000000 -0800
+++ libevent-1.3b_modified/http.c	2007-07-26 11:46:33.000000000 -0700
@@ -640,8 +640,10 @@
 			if (p == NULL)
 				break;
 			/* the last chunk is on a new line? */
-			if (strlen(p) == 0)
+			if (strlen(p) == 0) {
+				free(p);
 				continue;
+			}
 			req->ntoread = strtol(p, &endp, 16);
 			error = *p == '\0' || (*endp != '\0' && *endp != ' ');
 			free(p);

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to