From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s3NLemB8011096 for ; Wed, 23 Apr 2014 17:40:48 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s3NLelOc010123; Wed, 23 Apr 2014 17:40:47 -0400 (EDT) Date: Wed, 23 Apr 2014 17:40:47 -0400 (EDT) Message-Id: <201404232140.s3NLelOc010123@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Audit malloc(3)/calloc(3)/realloc(3) usage. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Audit malloc(3)/calloc(3)/realloc(3) usage. First committed to wrong branch, sorry. Modified Files: -------------- mdocml: cgi.c Revision Data ------------- Index: cgi.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/cgi.c,v retrieving revision 1.50 retrieving revision 1.51 diff -Lcgi.c -Lcgi.c -u -p -r1.50 -r1.51 --- cgi.c +++ cgi.c @@ -936,7 +936,7 @@ pg_search(const struct req *req, char *p 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++; @@ -1180,9 +1180,8 @@ pathgen(DIR *dir, char *path, struct 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. -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv