Moved memset to after check for null memory pointer

This commit is contained in:
Robert Osfield 2017-11-02 11:48:39 +00:00
parent 9dc6c454f4
commit 1bf2db24f2

View File

@ -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);