X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fquickhull.c;h=4c46ca0887f4c4fc3e73fb9482c16d9a2093e5e6;hp=bf3036a1539bd61ded1953317c36c3227adafa0b;hb=refs%2Fheads%2Fmaster;hpb=78add6e627ee5f10e1fa6f3852602ea5066eee5a diff --git a/hacks/glx/quickhull.c b/hacks/glx/quickhull.c index bf3036a1..4c46ca08 100644 --- a/hacks/glx/quickhull.c +++ b/hacks/glx/quickhull.c @@ -52,8 +52,12 @@ # include "config.h" #endif /* HAVE_CONFIG_H */ +extern const char *progname; + #include "quickhull.h" +#include "screenhackI.h" /* for jwxyz_abort */ + #include /* sqrt & fabs */ #include /* FILE */ #include /* memcpy */ @@ -1189,6 +1193,22 @@ qh__init_context(qh_context_t* context, qh_vertex_t const* vertices, context->newhorizonedges.begin = QH_MALLOC(qh_index_t, nedges); context->valid = QH_MALLOC(char, nfaces); + if (!(context->edges && + context->faces && + context->facestack.begin && + context->scratch.begin && + context->horizonedges.begin && + context->newhorizonedges.begin && + context->valid)) { +# ifdef HAVE_JWXYZ + jwxyz_abort ("%s: out of memory", progname); +# else + fprintf (stderr, "%s: out of memory\n", progname); + exit (1); +# endif + } + + context->vertices = QH_MALLOC(qh_vertex_t, nvertices); memcpy(context->vertices, vertices, sizeof(qh_vertex_t) * nvertices);