X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/6178e80e4a1d86d0633226cf4f9c244f968d3925..6e91de5a8d1bd3c94f6bf6c80e284a374a5c7187:/client/reveng/reveng.c?ds=sidebyside diff --git a/client/reveng/reveng.c b/client/reveng/reveng.c index dd50987c..d82353f8 100644 --- a/client/reveng/reveng.c +++ b/client/reveng/reveng.c @@ -141,8 +141,10 @@ reveng(const model_t *guess, const poly_t qpoly, int rflags, int args, const pol 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; @@ -471,9 +473,12 @@ chkres(int *resc, model_t **result, const poly_t divisor, const poly_t init, int 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);