Drew's normpath patch (was: Re: glibc??)
Jacob Smullyan <[email protected]> Thu, 5 Jan 2006 22:41:34 -0500
| Newsgroups | gmane.comp.web.skunkweb |
|---|---|
| Message-ID | <[email protected]> |
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
sw.diff
(text/plain, 1 KB)
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;
}
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQFDvebtuqamFyFXXLIRAgF+AJ9E78BY0Tb1B1gdzFV1MvuSBb+k9QCgqHzr raDSOGzbuo6Gw/702eaoy4Q= =OSpW -----END PGP SIGNATURE-----