From 23af57eeb2f65a540465aa609726c961f93e743c Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 1 Jun 2011 13:22:55 -0400 Subject: [PATCH] Don't try to allocate a temp array if the preshader has no temps. --- mojoshader_effects.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mojoshader_effects.c b/mojoshader_effects.c index 11157f2c..714d0423 100644 --- a/mojoshader_effects.c +++ b/mojoshader_effects.c @@ -20,8 +20,12 @@ void MOJOSHADER_runPreshader(const MOJOSHADER_preshader *preshader, // opcodes in the preshader instruction set (at the moment, at least). const int scalarstart = (int) MOJOSHADER_PRESHADEROP_SCALAR_OPS; - double *temps = (double *) alloca(sizeof (double) * preshader->temp_count); - memset(temps, '\0', sizeof (double) * preshader->temp_count); + double *temps = NULL; + if (preshader->temp_count > 0) + { + temps = (double *) alloca(sizeof (double) * preshader->temp_count); + memset(temps, '\0', sizeof (double) * preshader->temp_count); + } // if double dst[4]; double src[3][4];