Re: Drew's normpath patch (was: Re: glibc??)

Jacob Smullyan <[email protected]> Thu, 2 Mar 2006 15:12:05 -0500
Newsgroups gmane.comp.web.skunkweb
Message-ID <[email protected]>
I ended up getting bitten by this bug, too.  I added a virtual host
and suddenly got errors, with the glibc detected free() error on the
console, just for that host.  Applying this patch made the problem go
away.  Weird.  So I've checked it in.  

I will be doing a release within the next week or so.

js

On Thu, Jan 05, 2006 at 10:41:34PM -0500, Jacob Smullyan wrote:
> Drew's patch for the FC4 normpath problem.
> 
> ----- Forwarded message from Drew Csillag <[email protected]> -----
> 
> Return-Path: [email protected]
> Delivered-To: [email protected]
> DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
>   s=s1024; d=yahoo.com;
>   h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding;
>   b=QEGP5PWAm1ORClNLA12DSo3lOoNksYifldvpYcNGWVEtyptzx13HJb/8p0k/zVY3tF0C1VzYJYfbwFsDyBUPrejoJPV8rF5G0pDqqKaAC6DgYRnDlChrPSrK1CDAgg1cwOR5I2cTNcKcWwAh5NbqveWreYjgcyddMYZDVtqhxhk=  ;
> Date: Fri, 23 Sep 2005 07:05:36 -0700 (PDT)
> From: Drew Csillag <[email protected]>
> Subject: small patch to _normpath.c
> To: Jacob Smullyan <[email protected]>
> Content-Type: multipart/mixed; boundary="0-1402088261-1127484336=:67027"
> Content-Transfer-Encoding: 8bit
> 
> I was moving skunkweb (originally compiled on Redhat 7.2) to Redhat
> 4.0 and for reasons I don't entirely understand was running into core
> dumps in _normpath upon calls to free().  This one switches the
> malloc()s to alloca()s (since the allocated memory isn't used outside
> itself).
> 
> Cheers,
> Drew
> 
> 
> 		
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> 
> 
> ----- End forwarded message -----
> 
> -- 
> Jacob Smullyan

> diff -ur skunkweb-3.4.0/pylibs/skunklib/_normpath.c skunkweb/pylibs/skunklib/_normpath.c
> --- skunkweb-3.4.0/pylibs/skunklib/_normpath.c	2003-05-01 16:46:02.000000000 -0400
> +++ skunkweb/pylibs/skunklib/_normpath.c	2005-09-22 14:00:03.000000000 -0400
> @@ -35,9 +35,9 @@
>  	return NULL;
>  
>  #undef DEBUG
> -    parts = (struct str*)malloc( sizeof(struct str) * len );
> -    newparts = (struct str*)malloc( sizeof(struct str) * len );
> -    newpath = (char*)malloc( sizeof(char) * len + 1);
> +    parts = (struct str*)alloca( sizeof(struct str) * len );
> +    newparts = (struct str*)alloca( sizeof(struct str) * len );
> +    newpath = (char*)alloca( sizeof(char) * len + 1);
>      
>      /* do the string.split */
>      for (i = 0; i < len; i++)
> @@ -136,9 +136,9 @@
>      printf("newpathlen = %d len = %d\n", newpathlen, len);
>  #endif 
>      ret = PyString_FromStringAndSize(newpath, newpathlen);
> -    free(newpath);
> -    free(parts);
> -    free(newparts);
> +//    free(newpath);
> +//    free(parts);
> +//    free(newparts);
>      return ret;
>  }
>  




-- 
Jacob Smullyan
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEB1GVuqamFyFXXLIRArheAJ9qCPZEu1I86b91jiBs68f7h3cHsQCfbdza
p+vEuuOQTKQjhbwSriYqPZM=
=ZiRN
-----END PGP SIGNATURE-----