summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-03-09 14:50:11 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2004-03-09 14:50:11 (GMT)
commitd196309341a76a8427e9787542c02e6f3cf8ece5 (patch)
tree41c33f6a7c18a748734ca5e0caa5f6d4ca0d8d8d /TSRM
parente1127cb51492416757a0cbd1e767c70238e2024f (diff)
downloadphp-d196309341a76a8427e9787542c02e6f3cf8ece5.tar.gz
Fixed bug #27338 (memory leak inside tsrm_virtual_cwd.c on win32).
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index 4c58398..2f9ae21 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -302,6 +302,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
unsigned char is_absolute = 0;
#ifndef TSRM_WIN32
char resolved_path[MAXPATHLEN];
+ char *new_path;
#endif
if (path_length == 0)
@@ -340,7 +341,6 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
#if defined(TSRM_WIN32)
{
char *dummy = NULL;
- char *new_path;
int new_path_length;
new_path_length = GetLongPathName(path, dummy, 0) + 1;
@@ -357,6 +357,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
path_length = new_path_length;
} else {
free(new_path);
+ new_path = NULL;
}
}
#endif
@@ -463,7 +464,11 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
free(old_state);
-
+#ifdef TSRM_WIN32
+ if (new_path) {
+ free(new_path);
+ }
+#endif
free(free_path);
#if VIRTUAL_CWD_DEBUG
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);