Skip to content

Commit 416aa06

Browse files
committed
lc-compile: Ensure file pointer is initialised at declaration
In `GetFilenameOfPosition()`, it is possible for `GetFileOfPosition()` not to provide a valid `MCFileRef`. In that case, `GetFileOfPath()` would dereference uninitialised value as a pointer.
1 parent d51bcee commit 416aa06

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

toolchain/libcompile/src/position.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void GetFileOfPosition(long p_position, FileRef *r_file)
9595

9696
void GetFilenameOfPosition(long p_position, const char **r_filename)
9797
{
98-
FileRef t_file;
98+
FileRef t_file = NULL;
9999
GetFileOfPosition(p_position, &t_file);
100100
GetFilePath(t_file, r_filename);
101101
}

0 commit comments

Comments
 (0)