Skip to content

Commit e91c188

Browse files
author
Andi Gutmans
committed
- Fix memory leak.
1 parent 9bd721e commit e91c188

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main/fopen_wrappers.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path)
975975
new_state.cwd_length = strlen(cwd);
976976

977977
if(virtual_file_ex(&new_state, filepath, NULL)) {
978+
free(new_state.cwd);
978979
return NULL;
979980
}
980981

@@ -984,8 +985,8 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path)
984985
real_path[copy_len]='\0';
985986
} else {
986987
real_path = estrndup(new_state.cwd, new_state.cwd_length);
987-
free(new_state.cwd);
988988
}
989+
free(new_state.cwd);
989990

990991
return real_path;
991992
}

0 commit comments

Comments
 (0)