httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <>
Subject Re: calling pstrdup() on value before table_set?
Date Sun, 21 Dec 1997 03:06:45 GMT
On Sat, 20 Dec 1997, Dean Gaudet wrote:

> Oh interesting... I wasn't aware that table_set() duplicated the value
> behind the scenes as well.  Damn, these should all be cleaned up then.
> Either that or the table_*() functions should be changed to not
> duplicate... I wonder which wastes less memory.  Not duplicating is likely
> to be a source of bugs though, because you have to allocate into the right
> pool. 

Tough call.  A lot of places can get by without needing two copies of
something because they will never be changed until the old information in
the table wouldn't be used anyway.  Finding those places and verifying
them would be very ugly though and far too bug-inducing. 

Most code doesn't do a pstrdup() though.  Probably best off just leaving
table_set doing it and removing it whereever something does it for no
resaon before calling table_set(). 

> Dean
> On Sat, 20 Dec 1997, Marc Slemko wrote:
> > There are a number of cases in the code where something like:
> > 
> >     table_set(new->subprocess_env, "REDIRECT_STATUS", pstrdup(r->pool, t));
> > 
> > happens.  There is no reason for the pstrdup() except to waste memory is
> > there?
> > 
> > 

View raw message