progs/demos: Assert that input to malloc is valid.
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
* Humanware s.r.l.
|
* Humanware s.r.l.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -759,6 +760,7 @@ main(int ac, char **av)
|
|||||||
glFogfv(GL_FOG_COLOR, fogcolor);
|
glFogfv(GL_FOG_COLOR, fogcolor);
|
||||||
glFogf(GL_FOG_DENSITY, 0.1);
|
glFogf(GL_FOG_DENSITY, 0.1);
|
||||||
|
|
||||||
|
assert(np > 0);
|
||||||
p = (part *) malloc(sizeof(part) * np);
|
p = (part *) malloc(sizeof(part) * np);
|
||||||
|
|
||||||
for (i = 0; i < np; i++)
|
for (i = 0; i < np; i++)
|
||||||
|
Reference in New Issue
Block a user