[Bf-committers] Memory leak fix

uniq2ma at yahoo.it uniq2ma at yahoo.it
Sat Jul 12 01:09:28 CEST 2008


The last commit is wrong:

Index: source/blender/blenlib/intern/storage.c
===================================================================
--- source/blender/blenlib/intern/storage.c	(revision 15530)
+++ source/blender/blenlib/intern/storage.c	(working copy)
@@ -382,6 +382,7 @@
 			pwuser = getpwuid(files[num].s.st_uid);
 			if ( pwuser ) {
 			strcpy(files[num].owner, pwuser->pw_name);
+			free(pwuser);
 			} else {
 				sprintf(files[num].owner, "%d", files[num].s.st_uid);



start blender and crash:



Compiled with Python version 2.5.2.
Checking for installed Python... got it!
*** glibc detected *** blender: free(): invalid pointer:
0x0000003574b508a0 ***
======= Backtrace: =========
/lib/libc.so.6[0x3574873978]
/lib/libc.so.6(cfree+0x76)[0x3574875a86]
blender(BLI_adddirstrings+0x193)[0xc9f243]
blender(BLI_getdir+0x34)[0xc9fcd4]
blender[0x856cd3]
blender(BIF_icons_init+0xf)[0x85962f]
blender(BIF_init+0x13d)[0x57349d]
blender(main+0x3c9)[0x56bd79]
/lib/libc.so.6(__libc_start_main+0xe6)[0x357481e1a6]
blender[0x56b439]


>From "getpwuid" manual:

>...
>The return value may point to static area, and may be overwritten by
>subsequent calls to getpwent(3), getpwnam(), or getpwuid().
>...

the call to function "free" is wrong or change the code to use the
function "getpwuid_r" if available.

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



More information about the Bf-committers mailing list