From e91c188e8534ab1cff38be024b2f69a3336e2b8f Mon Sep 17 00:00:00 2001 From: Andi Gutmans Date: Thu, 12 Oct 2000 19:58:20 +0000 Subject: [PATCH] - Fix memory leak. --- main/fopen_wrappers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index 18e74ec3c73..40aa8d2f2c8 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -975,6 +975,7 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path) new_state.cwd_length = strlen(cwd); if(virtual_file_ex(&new_state, filepath, NULL)) { + free(new_state.cwd); return NULL; } @@ -984,8 +985,8 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path) real_path[copy_len]='\0'; } else { real_path = estrndup(new_state.cwd, new_state.cwd_length); - free(new_state.cwd); } + free(new_state.cwd); return real_path; }