[SSSD] [PATCH] Every time release allocated memory in function

Jakub Hrozek jhrozek at redhat.com
Wed Jul 24 12:17:28 UTC 2013


On Wed, Jul 24, 2013 at 02:15:12PM +0200, Jakub Hrozek wrote:
> On Wed, Jul 24, 2013 at 02:09:22PM +0200, Lukas Slebodnik wrote:
> > On (24/07/13 13:52), Jakub Hrozek wrote:
> > >On Wed, Jul 24, 2013 at 12:06:41PM +0200, Lukas Slebodnik wrote:
> > >> ehlo,
> > >> 
> > >> Memory leak was found by coverity. (and also by scan-build)
> > >> 
> > >> Patch is attached.
> > >> 
> > >> LS
> > >
> > >> From 5b84e6f9114b623c01cb0bc50ae7405c6225c91f Mon Sep 17 00:00:00 2001
> > >> From: Lukas Slebodnik <lslebodn at redhat.com>
> > >> Date: Wed, 24 Jul 2013 10:52:08 +0200
> > >> Subject: [PATCH] Every time release allocated memory in function
> > >>  py_sss_getgrouplist
> > >> 
> > >> Coverity: 11922
> > >> ---
> > >>  src/python/pysss.c | 1 +
> > >>  1 file changed, 1 insertion(+)
> > >> 
> > >> diff --git a/src/python/pysss.c b/src/python/pysss.c
> > >> index 4dd0351354aadb185a25f5c54e945f8397d7dcf7..284947be184054122b425b31e42615b1fa10b2e2 100644
> > >> --- a/src/python/pysss.c
> > >> +++ b/src/python/pysss.c
> > >> @@ -804,6 +804,7 @@ static PyObject *py_sss_getgrouplist(PyObject *self, PyObject *args)
> > >>              idx++;
> > >>          }
> > >>      }
> > >> +    free(groups);
> > >>  
> > >
> > >Nice catch but I would prefer if you also set groups to NULL here so
> > >that if in the future we add a goto fail to the code after the groups
> > >array is freed, we don't attempt to free groups again.
> > 
> > Thank you for review.
> > Updated patch is attached.
> > 
> > LS
> 
> Ack

Pushed to master.



More information about the sssd-devel mailing list