diff --git a/src/r_data.c b/src/r_data.c
index 3a7fb602edba28bfdc0fbc28ff7fe42eccdce4cf..34141489f961cf5df723ff011189d6eb9d563a9e 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -1604,7 +1604,7 @@ void R_PrecacheLevel(void)
 	//
 	// no need to precache all software textures in 3D mode
 	// (note they are still used with the reference software view)
-	texturepresent = calloc(numtextures, sizeof (*texturepresent));
+	texturepresent = calloc(numtextures+1, sizeof (*texturepresent));
 	if (texturepresent == NULL) I_Error("%s: Out of memory looking up textures", "R_PrecacheLevel");
 
 	for (j = 0; j < numsides; j++)