@@ -4132,7 +4132,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
41324132 return SUCCESS ;
41334133 }
41344134 /* strip .. from path and restrict it to be under dest directory */
4135- new_state .cwd = (char * )malloc (2 );
4135+ new_state .cwd = (char * )emalloc (2 );
41364136 new_state .cwd [0 ] = DEFAULT_SLASH ;
41374137 new_state .cwd [1 ] = '\0' ;
41384138 new_state .cwd_length = 1 ;
@@ -4145,7 +4145,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
41454145 } else {
41464146 spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
41474147 }
4148- free (new_state .cwd );
4148+ efree (new_state .cwd );
41494149 return FAILURE ;
41504150 }
41514151 filename = new_state .cwd + 1 ;
@@ -4177,29 +4177,29 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
41774177 spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s...\", extracted filename is too long for filesystem" , entry -> filename , fullpath );
41784178 }
41794179 efree (fullpath );
4180- free (new_state .cwd );
4180+ efree (new_state .cwd );
41814181 return FAILURE ;
41824182 }
41834183
41844184 if (!len ) {
41854185 spprintf (error , 4096 , "Cannot extract \"%s\", internal error" , entry -> filename );
41864186 efree (fullpath );
4187- free (new_state .cwd );
4187+ efree (new_state .cwd );
41884188 return FAILURE ;
41894189 }
41904190
41914191 if (PHAR_OPENBASEDIR_CHECKPATH (fullpath )) {
41924192 spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s\", openbasedir/safe mode restrictions in effect" , entry -> filename , fullpath );
41934193 efree (fullpath );
4194- free (new_state .cwd );
4194+ efree (new_state .cwd );
41954195 return FAILURE ;
41964196 }
41974197
41984198 /* let see if the path already exists */
41994199 if (!overwrite && SUCCESS == php_stream_stat_path (fullpath , & ssb )) {
42004200 spprintf (error , 4096 , "Cannot extract \"%s\" to \"%s\", path already exists" , entry -> filename , fullpath );
42014201 efree (fullpath );
4202- free (new_state .cwd );
4202+ efree (new_state .cwd );
42034203 return FAILURE ;
42044204 }
42054205
@@ -4237,7 +4237,7 @@ static int phar_extract_file(zend_bool overwrite, phar_entry_info *entry, char *
42374237 }
42384238
42394239 filename = NULL ;
4240- free (new_state .cwd );
4240+ efree (new_state .cwd );
42414241 /* it is a standalone directory, job done */
42424242 if (entry -> is_dir ) {
42434243 efree (fullpath );
0 commit comments