pcp
[Top] [All Lists]

Re: [pcp] [patch] memory leak in xfs project quotas

To: Martin Hicks <mort@xxxxxxx>
Subject: Re: [pcp] [patch] memory leak in xfs project quotas
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Thu, 07 May 2009 08:13:44 +1000
Cc: pcp@xxxxxxxxxxx
In-reply-to: <20090506191613.GR14353@xxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20090506191613.GR14353@xxxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: kenj@xxxxxxxxxxxxxxxx
Looks fine to me Martin.

On Wed, 2009-05-06 at 14:16 -0500, Martin Hicks wrote:
> In the linux PMDA.  Any complaints with this patch?
> 
> The changes at the beginning just get rid of whitespace annoyances.
> The last two hunks are what fix the problem.
> 
> thanks
> mh
> 
> diff --git a/src/pmdas/linux/filesys.c b/src/pmdas/linux/filesys.c
> index 033da2e..a16abfc 100644
> --- a/src/pmdas/linux/filesys.c
> +++ b/src/pmdas/linux/filesys.c
> @@ -26,15 +26,15 @@
>  static void 
>  refresh_filesys_projects(pmInDom qindom, filesys_t *fs)
>  {
> -    char               buffer[MAXPATHLEN];
> +    char               buffer[MAXPATHLEN];
>      project_t          *qp;
>      fs_quota_stat_t    s;
>      fs_disk_quota_t    d;
>      size_t             idsz, devsz;
>      FILE               *projects;
> -    char               *p, *idend;
> -    uint32_t           prid;
> -    int                qcmd, sts;
> +    char               *p, *idend;
> +    uint32_t           prid;
> +    int                        qcmd, sts;
>  
>      qcmd = QCMD(Q_XGETQSTAT, XQM_PRJQUOTA);
>      if (quotactl(qcmd, fs->device, 0, (void*)&s) < 0)
> @@ -75,7 +75,7 @@ refresh_filesys_projects(pmInDom qindom, filesys_t *fs)
>         qp = NULL;
>         sts = pmdaCacheLookupName(qindom, p, NULL, (void **)&qp);
>         if (sts == PMDA_CACHE_ACTIVE)   /* repeated line in /etc/projects? */
> -           continue;
> +           goto next;
>         if (sts != PMDA_CACHE_INACTIVE) {
>             qp = (project_t *)malloc(sizeof(project_t));
>  #if PCP_DEBUG
> @@ -92,6 +92,8 @@ refresh_filesys_projects(pmInDom qindom, filesys_t *fs)
>         qp->files_used = d.d_icount;
>         qp->files_time_left = d.d_itimer;
>         pmdaCacheStore(qindom, PMDA_CACHE_ADD, p, (void *)qp);
> +next:
> +       free(p);
>      }
>      fclose(projects);
>  }
> 
> 
> _______________________________________________
> pcp mailing list
> pcp@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/pcp

<Prev in Thread] Current Thread [Next in Thread>