=================================================================== RCS file: /cvs/mandoc/cgi.c,v retrieving revision 1.49 retrieving revision 1.51 diff -u -p -r1.49 -r1.51 --- mandoc/cgi.c 2014/03/19 22:20:43 1.49 +++ mandoc/cgi.c 2014/04/23 21:40:47 1.51 @@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.49 2014/03/19 22:20:43 schwarze Exp $ */ +/* $Id: cgi.c,v 1.51 2014/04/23 21:40:47 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * @@ -43,6 +43,7 @@ #include "apropos_db.h" #include "mandoc.h" +#include "mandoc_aux.h" #include "mdoc.h" #include "man.h" #include "main.h" @@ -935,7 +936,7 @@ pg_search(const struct req *req, char *path) ep++; while (ep && '\0' != *ep) { - cp = mandoc_realloc(cp, (sz + 1) * sizeof(char *)); + cp = mandoc_reallocarray(cp, sz + 1, sizeof(char *)); start = ep; while ('\0' != *ep && ! isspace((unsigned char)*ep)) ep++; @@ -1179,9 +1180,8 @@ pathgen(DIR *dir, char *path, struct req *req) if (rc > 0) { /* This also strips the trailing slash. */ path[(int)--sz] = '\0'; - req->p = mandoc_realloc - (req->p, - (req->psz + 1) * sizeof(struct paths)); + req->p = mandoc_reallocarray(req->p, + req->psz + 1, sizeof(struct paths)); /* * Strip out the leading "./" unless we're just a ".", * in which case use an empty string as our name.