bug-gnulib
[Top][All Lists]
Advanced

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

[bug-gnulib] Suggested addition for mountlist.c: free_file_system_list()


From: James Youngman
Subject: [bug-gnulib] Suggested addition for mountlist.c: free_file_system_list()
Date: Mon, 6 Dec 2004 00:17:33 +0000
User-agent: Mutt/1.3.28i

Hello,

I have just converted findutils to use the mountlist module from
gnulib (in order to solve UNICOS compilation difficulties with
findutils 4.2.9).  GNU may call read_file_system_list() many times.
To prevent memory leaks I have added the following function to
findutils:

void
free_file_system_list(struct mount_entry *p)
{
  while (p)
    {
      struct mount_entry *pnext = p->me_next;
      
      free(p->me_devname);
      free(p->me_mountdir);
      if (p->me_type_malloced)
        free(p->me_type);

      p->me_next = NULL;
      free(p);
      p = pnext;
    }
}

I'm currently using this as a static function inside findutils'
fstype.c module.  I have not tested it in the (p->me_type_malloced==0)
case.

As regards assignment paperwork, this code is already part of GNU
findutils so it already belongs to the FSF.  Hence (I assume) no
problem including it into gnulib if that seems like a good idea to
you.

Regards,
James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]