@@ -181,7 +181,7 @@ static char* temporary_directory;
181
181
PHPAPI void php_shutdown_temporary_directory (void )
182
182
{
183
183
if (temporary_directory ) {
184
- free (temporary_directory );
184
+ efree (temporary_directory );
185
185
temporary_directory = NULL ;
186
186
}
187
187
}
@@ -202,10 +202,10 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
202
202
if (sys_temp_dir ) {
203
203
int len = strlen (sys_temp_dir );
204
204
if (len >= 2 && sys_temp_dir [len - 1 ] == DEFAULT_SLASH ) {
205
- temporary_directory = zend_strndup (sys_temp_dir , len - 1 );
205
+ temporary_directory = estrndup (sys_temp_dir , len - 1 );
206
206
return temporary_directory ;
207
207
} else if (len >= 1 && sys_temp_dir [len - 1 ] != DEFAULT_SLASH ) {
208
- temporary_directory = zend_strndup (sys_temp_dir , len );
208
+ temporary_directory = estrndup (sys_temp_dir , len );
209
209
return temporary_directory ;
210
210
}
211
211
}
@@ -222,9 +222,9 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
222
222
DWORD len = GetTempPath (sizeof (sTemp ),sTemp );
223
223
assert (0 < len ); /* should *never* fail! */
224
224
if (sTemp [len - 1 ] == DEFAULT_SLASH ) {
225
- temporary_directory = zend_strndup (sTemp , len - 1 );
225
+ temporary_directory = estrndup (sTemp , len - 1 );
226
226
} else {
227
- temporary_directory = zend_strndup (sTemp , len );
227
+ temporary_directory = estrndup (sTemp , len );
228
228
}
229
229
return temporary_directory ;
230
230
}
@@ -236,9 +236,9 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
236
236
int len = strlen (s );
237
237
238
238
if (s [len - 1 ] == DEFAULT_SLASH ) {
239
- temporary_directory = zend_strndup (s , len - 1 );
239
+ temporary_directory = estrndup (s , len - 1 );
240
240
} else {
241
- temporary_directory = zend_strndup (s , len );
241
+ temporary_directory = estrndup (s , len );
242
242
}
243
243
244
244
return temporary_directory ;
@@ -247,12 +247,12 @@ PHPAPI const char* php_get_temporary_directory(TSRMLS_D)
247
247
#ifdef P_tmpdir
248
248
/* Use the standard default temporary directory. */
249
249
if (P_tmpdir ) {
250
- temporary_directory = strdup (P_tmpdir );
250
+ temporary_directory = estrdup (P_tmpdir );
251
251
return temporary_directory ;
252
252
}
253
253
#endif
254
254
/* Shouldn't ever(!) end up here ... last ditch default. */
255
- temporary_directory = strdup ("/tmp" );
255
+ temporary_directory = estrndup ("/tmp" , sizeof ( "/tmp" ) );
256
256
return temporary_directory ;
257
257
#endif
258
258
}
0 commit comments