source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Audit malloc(3)/calloc(3)/realloc(3) usage.
Date: Wed, 23 Apr 2014 17:40:47 -0400 (EDT)	[thread overview]
Message-ID: <201404232140.s3NLelOc010123@krisdoz.my.domain> (raw)

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

             reply	other threads:[~2014-04-23 21:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 21:40 schwarze [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-23 21:06 schwarze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201404232140.s3NLelOc010123@krisdoz.my.domain \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).