/* reveng.c
- * Greg Cook, 9/Apr/2015
+ * Greg Cook, 24/Feb/2016
*/
/* CRC RevEng, an arbitrary-precision CRC calculator and algorithm finder
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Gregory Cook
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Gregory Cook
*
* This file is part of CRC RevEng.
*
engini(&resc, &result, guess->spoly, guess->flags, args, argpolys);
requit:
- if(!(result = realloc(result, ++resc * sizeof(model_t))))
+ if(!(result = realloc(result, ++resc * sizeof(model_t)))) {
uerror("cannot reallocate result array");
+ return NULL;
+ }
rptr = result + resc - 1;
rptr->spoly = pzero;
rptr->init = pzero;
pfree(&xor);
if(aptr != eptr) return;
- if(!(*result = realloc(*result, ++*resc * sizeof(model_t))))
+ *result = realloc(*result, ++*resc * sizeof(model_t));
+ if (!*result) {
uerror("cannot reallocate result array");
-
+ return;
+ }
+
rptr = *result + *resc - 1;
rptr->spoly = pclone(divisor);
rptr->init = pclone(init);