Hi,

On Tue, Jun 07, 2016 at 01:00:40AM +0500, ???????? ?????????????? wrote:
> like that ?

Looks good indeed, but I'd add something :

> --- src/proxy.c.orig    2016-06-07 00:56:29.001214621 +0500
> +++ src/proxy.c    2016-06-07 00:59:01.823568543 +0500
> @@ -426,11 +426,14 @@
>              hdr->index = curpx->nb_req_cap++;
>              curpx->req_cap = hdr;
>          }
> -        if (strcmp(args[2], "response") == 0) {
> +        else if (strcmp(args[2], "response") == 0) {
>              hdr->next = curpx->rsp_cap;
>              hdr->index = curpx->nb_rsp_cap++;
>              curpx->rsp_cap = hdr;
>          }
> +        else {
> +            free(hdr);

Here, please add this line :

               hdr = NULL;

It serves as a safety guard against a double free or a use-after-free if
someone later adds more code after this statement and the condition becomes
messed up. It's generally good hygiene to assign nulls after a free.

Please submit a complete patch with a commit message, I'll happily merge it.
(Just read CONTRIBUTING if you're unsure).

thanks,
Willy


Reply via email to