Fixes a segmentation fault in conform divzero.c test.
This happens when glTexImage(level, width=0, height=0) is called. We
don't allocate texture memory in that case so the ImageSlices array
was never allocated.
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
continue;
}
+ if (!swImage->ImageSlices) {
+ swImage->ImageSlices =
+ calloc(texture_slices(texImage), sizeof(void *));
+ if (!swImage->ImageSlices)
+ continue;
+ }
+
for (i = 0; i < texture_slices(texImage); i++) {
GLubyte *map;
GLint rowStride;
if (swImage->Buffer)
return;
+ if (!swImage->ImageSlices)
+ continue;
+
for (i = 0; i < texture_slices(texImage); i++) {
if (swImage->ImageSlices[i]) {
ctx->Driver.UnmapTextureImage(ctx, texImage, i);