pcp
[Top] [All Lists]

Re: pmdagfs2: Updates from continued testing and changes for future upda

To: Paul Evans <pevans@xxxxxxxxxx>
Subject: Re: pmdagfs2: Updates from continued testing and changes for future updates
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Wed, 9 Oct 2013 22:42:12 -0400 (EDT)
Cc: PCP Mailing List <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <803653382.4750679.1381361383830.JavaMail.root@xxxxxxxxxx>
References: <525590DB.3080007@xxxxxxxxxx> <803653382.4750679.1381361383830.JavaMail.root@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: UaW4QpfP5Jf/OEyT4tp2Id+dms+3g7kxwywI
Thread-topic: pmdagfs2: Updates from continued testing and changes for future updates
> ...
> ps: please let me know if there's more planned for within a day or two,
> so I can ensure everything gets merged in time ... thanks!
> 

Also, could you review & merge this if OK?  (Coverity scanning found it)
We should really be checking the return code from calloc here too, BTW.


diff --git a/src/pmdas/gfs2/pmda.c b/src/pmdas/gfs2/pmda.c
index d57cfbd..4b42fb7 100644
--- a/src/pmdas/gfs2/pmda.c
+++ b/src/pmdas/gfs2/pmda.c
@@ -252,8 +252,10 @@ gfs2_instance_refresh(void)
            fs = calloc(1, sizeof(struct gfs2_fs));
             fs->dev_id = gfs2_device_identifier(name);
 
-            if ((major(fs->dev_id) == 0) && (minor(fs->dev_id) == 0))
+            if ((major(fs->dev_id) == 0) && (minor(fs->dev_id) == 0)) {
+                free(fs);
                 return PM_ERR_AGAIN;
+           }
 
         }   
        else if (sts < 0)


cheers.

--
Nathan

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