]> granicus.if.org Git - php/commitdiff
- Fix memory leak.
authorAndi Gutmans <andi@php.net>
Thu, 12 Oct 2000 19:58:20 +0000 (19:58 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 12 Oct 2000 19:58:20 +0000 (19:58 +0000)
main/fopen_wrappers.c

index 18e74ec3c73478acb96c5745c15d0faaf0fd95a8..40aa8d2f2c88e734141e564414889c1ea4f11b31 100644 (file)
@@ -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;
 }