[Yum-devel] [PATCH 1/2] writeout_final_defers() changes

seth vidal skvidal at fedoraproject.org
Tue Nov 15 16:49:34 UTC 2011


On Tue, 15 Nov 2011 13:58:53 +0100
Zdeněk Pavlas <zpavlas at redhat.com> wrote:

> - fix memory leak
> - group output by inode
> ---
>  src/copyout.c |   37 +++++++++++++++++++++----------------
>  1 files changed, 21 insertions(+), 16 deletions(-)
> 
> diff --git a/src/copyout.c b/src/copyout.c
> index ab6a243..d8c19a0 100644
> --- a/src/copyout.c
> +++ b/src/copyout.c
> @@ -244,24 +244,29 @@ writeout_defered_file (struct cpio_file_stat
> *header, int out_file_des) static void
>  writeout_final_defers (int out_des)
>  {
> -  struct deferment *d;
> -  int other_count;
>    while (deferouts != NULL)
>      {
> -      d = deferouts;
> -      other_count = count_defered_links_to_dev_ino (&d->header);
> -      if (other_count == 1)
> -	{
> -	  writeout_defered_file (&d->header, out_des);
> -	}
> -      else
> -	{
> -	  struct cpio_file_stat file_hdr;
> -	  file_hdr = d->header;
> -	  file_hdr.c_filesize = 0;
> -	  write_out_header (&file_hdr, out_des);
> -	}
> -      deferouts = deferouts->next;
> +      struct deferment *h, *d;
> +      struct deferment **tail = &deferouts;
> +      for (h = d = deferouts; (d = d->next) != NULL;)
> +        {
> +          if (d->header.c_ino     == h->header.c_ino
> +	   && d->header.c_dev_maj == h->header.c_dev_maj
> +	   && d->header.c_dev_min == h->header.c_dev_min)
> +            {
> +              write_out_header (&h->header, out_des);
> +              free_deferment (h);
> +              h = d;
> +            }
> +          else
> +            {
> +              *tail = d;
> +              tail = &d->next;
> +            }
> +        }
> +      writeout_defered_file (&h->header, out_des);
> +      free_deferment (h);
> +      *tail = NULL;
>      }
>  }
>  


Pretty sure you sent this to the wrong list.

-sv


More information about the Yum-devel mailing list