Re: [PATCH v3 06/16] pathspec: copy and free owned memory

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

 



On Wed, Dec 14, 2016 at 6:14 AM, Brandon Williams <bmwill@xxxxxxxxxx> wrote:
>  void clear_pathspec(struct pathspec *pathspec)
>  {
> +       int i;
> +
> +       for (i = 0; i < pathspec->nr; i++) {
> +               free(pathspec->items[i].match);
> +               free(pathspec->items[i].original);
> +       }
>         free(pathspec->items);
>         pathspec->items = NULL;

We should set pathspec->nr to zero so that calling this function again
won't cause any harm.

>  }
-- 
Duy



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]