Use calloc() instaed of zeroing memory ourselves.

This commit is contained in:
Xin LI 2008-04-13 08:05:08 +00:00
parent 722bb56802
commit 92226c92f3

View File

@ -535,12 +535,11 @@ __format_grouped_double(double value, int *flags,
/* make sure that we've enough space for result string */
bufsize = strlen(avalue)*2+1;
rslt = malloc(bufsize);
rslt = calloc(1, bufsize);
if (rslt == NULL) {
free(avalue);
return (NULL);
}
memset(rslt, 0, bufsize);
bufend = rslt + bufsize - 1; /* reserve space for trailing '\0' */
/* skip spaces at beggining */