From: Richard D. <ric...@us...> - 2007-08-13 12:02:30
|
Update of /cvsroot/file-extattr/File-ExtAttr In directory sc8-pr-cvs17:/tmp/cvs-serv13974 Modified Files: Changes ExtAttr.xs MANIFEST Log Message: Bugfix: Fix a memory leak in getfattr() Index: ExtAttr.xs =================================================================== RCS file: /cvsroot/file-extattr/File-ExtAttr/ExtAttr.xs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ExtAttr.xs 6 May 2007 09:56:40 -0000 1.21 --- ExtAttr.xs 13 Aug 2007 12:02:28 -0000 1.22 *************** *** 84,87 **** --- 84,88 ---- //key not found, just return undef if(errno == ENOATTR){ + Safefree(attrvalue); XSRETURN_UNDEF; *************** *** 89,95 **** --- 90,98 ---- }else{ setattr_warn("getxattr", attrname, errno); + Safefree(attrvalue); XSRETURN_UNDEF; } } + RETVAL = newSVpv(attrvalue, attrlen); Safefree(attrvalue); *************** *** 122,125 **** --- 125,129 ---- //key not found, just return undef if(errno == ENOATTR){ + Safefree(attrvalue); XSRETURN_UNDEF; *************** *** 127,133 **** --- 131,139 ---- }else{ setattr_warn("fgetxattr", attrname, errno); + Safefree(attrvalue); XSRETURN_UNDEF; } } + RETVAL = newSVpv(attrvalue, attrlen); Safefree(attrvalue); Index: Changes =================================================================== RCS file: /cvsroot/file-extattr/File-ExtAttr/Changes,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Changes 5 Jul 2007 08:36:34 -0000 1.31 --- Changes 13 Aug 2007 12:02:28 -0000 1.32 *************** *** 1,5 **** Revision history for Perl extension File::ExtAttr. ! 1.05 2007-07-05 - (richdawe) Fix META.yml so that it's valid. Add a test using --- 1,5 ---- Revision history for Perl extension File::ExtAttr. ! 1.05 2007-08-13 - (richdawe) Fix META.yml so that it's valid. Add a test using *************** *** 11,14 **** --- 11,18 ---- by filename. + - (richdawe) Bugfix: Fix a memory leak in getfattr(). The memory was + leaked when the function failed, e.g.: if it was called + with the name of a non-existent attribute. + 1.04 2007-05-06 Index: MANIFEST =================================================================== RCS file: /cvsroot/file-extattr/File-ExtAttr/MANIFEST,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MANIFEST 23 Jun 2007 11:04:30 -0000 1.17 --- MANIFEST 13 Aug 2007 12:02:28 -0000 1.18 *************** *** 41,44 **** --- 41,45 ---- t/33nslong.t t/39nsempty.t + t/80memleakget.t lib/File/ExtAttr.pm lib/File/ExtAttr/Tie.pm |