[Libevent-users] fix for memory leak in evhttp_handle_chunked_read

Niels Provos provos at citi.umich.edu
Mon Jul 30 20:32:14 EDT 2007


Submitted.

Thank you,
 Niels.

On 7/26/07, Elliot F <elliotf-libevent at gratuitous.net> wrote:
> 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);
>
>
> _______________________________________________
> Libevent-users mailing list
> Libevent-users at monkey.org
> http://monkey.org/mailman/listinfo/libevent-users
>
>
>


More information about the Libevent-users mailing list