From: bah@longitude.com Date: Sat, 15 Apr 2006 13:54:10 +0000 (-0400) Subject: Potential (?) memory leak in Storable.xs (Coverity) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fc86f1263ad539fbebe503083dd7c866265f1ea5;p=p5sagit%2Fp5-mst-13.2.git Potential (?) memory leak in Storable.xs (Coverity) Message-ID: <1561.38.96.138.153.1145123650.squirrel@mail.longitude.com> Date: Sat, 15 Apr 2006 13:54:10 -0400 (EDT) p4raw-id: //depot/perl@27828 --- diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index a8beda1..b77853c 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -3989,8 +3989,11 @@ static SV *retrieve_blessed(pTHX_ stcxt_t *cxt, const char *cname) TRACEME(("new class name \"%s\" will bear ID = %d", classname, cxt->classnum)); - if (!av_store(cxt->aclass, cxt->classnum++, newSVpvn(classname, len))) + if (!av_store(cxt->aclass, cxt->classnum++, newSVpvn(classname, len))) { + if (classname != buf) + Safefree(classname); return (SV *) 0; + } /* * Retrieve object and bless it. @@ -4168,8 +4171,11 @@ static SV *retrieve_hook(pTHX_ stcxt_t *cxt, const char *cname) * Record new classname. */ - if (!av_store(cxt->aclass, cxt->classnum++, newSVpvn(classname, len))) + if (!av_store(cxt->aclass, cxt->classnum++, newSVpvn(classname, len))) { + if (classname != buf) + Safefree(classname); return (SV *) 0; + } } TRACEME(("class name: %s", classname));