On Thu, Jun 17, 2010 at 10:09:37AM -0400, Jeff Johnson wrote:
> 
> On Jun 17, 2010, at 4:27 AM, Markdv wrote:
> 
> > 
> > I just don't see why you wouldn't want to "fix" this. Seems like all you'd 
> > have to do is add
> > 
> >    con->os->nextArg = _free(con->os->nextArg);
> > 
> > to poptFreeContext(poptContext con) and be done with it.
> > 
> 
> There's a double free with your suggested "fix" if/when the application
> has also free'd the memory returned.
> 
> 73 de Jeff
> 

Sorry Jeff,
could you please show me an example of double-free against with that "fix" ?

For the poptGetOptArg(), you mentioned,
        ~snip~
        1554 char * poptGetOptArg(poptContext con)
        1555 {
        1556     char * ret = NULL;
        1557     if (con) {
        1558         ret = con->os->nextArg;
        1559         con->os->nextArg = NULL;
        1560     }
        1561     return ret;
        1562 }
        ~snip~
So if someone called the poptGetOptArg(), _free(con->os->nextArg) of the 
poptResetContext() will do nothing.

I know, this thread is too old.
But it was talking about popt >= 1.16 and people still are using the popt-1.16.
So it is not too old to continue.
______________________________________________________________________
POPT Library                                           http://rpm5.org
Developer Communication List                       popt-devel@rpm5.org

Reply via email to