Mesa (mesa_7_7_branch): progs/demos: Assert that input to malloc is valid.

Vinson Lee vlee at kemper.freedesktop.org
Thu Jan 7 05:43:16 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: d42467687e9de756aa3e4bca5e55f69391af3065
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d42467687e9de756aa3e4bca5e55f69391af3065

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Jan  6 21:39:44 2010 -0800

progs/demos: Assert that input to malloc is valid.

---

 progs/demos/fire.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/progs/demos/fire.c b/progs/demos/fire.c
index dd70f61..f30b893 100644
--- a/progs/demos/fire.c
+++ b/progs/demos/fire.c
@@ -6,6 +6,7 @@
  *            Humanware s.r.l.
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
@@ -759,6 +760,7 @@ main(int ac, char **av)
    glFogfv(GL_FOG_COLOR, fogcolor);
    glFogf(GL_FOG_DENSITY, 0.1);
 
+   assert(np > 0);
    p = (part *) malloc(sizeof(part) * np);
 
    for (i = 0; i < np; i++)




More information about the mesa-commit mailing list