Re: [hatari-devel] Analyse

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 23/07/2014 23:33, Cocoa Pod a écrit :
Bonsoir Thomas,

Should be false alarm.

~/hatari/src/paths.c
~/hatari/src/paths.c:90:3: Potential leak of memory pointed to by
‘pPathEnv'

I’m not sure of it. My comments in red:

79/* Get the PATH environment string */
80pPathEnv = getenv("PATH");
81if (!pPathEnv)
82return;*// Ok*
83/* Duplicate the string because strtok destroys it later */
84pPathEnv = strdup(pPathEnv);*// Strdup allocates memory enough for
duplication (M)*
85if (!pPathEnv)
86return;/*/ Ok*
87
88pTmpName = malloc(FILENAME_MAX);
99if (!pTmpName)
90return;*// Routin exits, pPathEnv disappear, memory (M) stay allocated.*

perhaps i’m wrong, my knowledge of C is not complete !



Hi,

yes, pPathEnv should be free'd in that case, but Thomas already commited a fix for this.

Nicolas




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/