svn commit: r278928 - head/usr.bin/ministat

Pedro F. Giffuni pfg at FreeBSD.org
Tue Feb 17 23:20:20 UTC 2015


Author: pfg
Date: Tue Feb 17 23:20:19 2015
New Revision: 278928
URL: https://svnweb.freebsd.org/changeset/base/278928

Log:
  ministat(1): replace malloc + memset with calloc.
  
  Reviewed by:	phk

Modified:
  head/usr.bin/ministat/ministat.c

Modified: head/usr.bin/ministat/ministat.c
==============================================================================
--- head/usr.bin/ministat/ministat.c	Tue Feb 17 23:14:26 2015	(r278927)
+++ head/usr.bin/ministat/ministat.c	Tue Feb 17 23:20:19 2015	(r278928)
@@ -329,10 +329,8 @@ PlotSet(struct dataset *ds, int val)
 	else
 		bar = 0;
 
-	if (pl->bar == NULL) {
-		pl->bar = malloc(sizeof(char *) * pl->num_datasets);
-		memset(pl->bar, 0, sizeof(char*) * pl->num_datasets);
-	}
+	if (pl->bar == NULL)
+		pl->bar = calloc(sizeof(char *), pl->num_datasets);
 	if (pl->bar[bar] == NULL) {
 		pl->bar[bar] = malloc(pl->width);
 		memset(pl->bar[bar], 0, pl->width);


More information about the svn-src-all mailing list