Moved memset to after check for null memory pointer
This commit is contained in:
parent
9dc6c454f4
commit
1bf2db24f2
@ -166,13 +166,14 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
|
||||
}
|
||||
|
||||
mapbase = malloc (st.st_size+1);
|
||||
memset(mapbase, 0, st.st_size+1);
|
||||
if (!mapbase)
|
||||
{
|
||||
close (file_fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(mapbase, 0, st.st_size+1);
|
||||
|
||||
if (read(file_fd, mapbase, st.st_size) != st.st_size)
|
||||
{
|
||||
close (file_fd);
|
||||
|
Loading…
Reference in New Issue
Block a user