Replace mh_xmalloc() with mh_xcalloc()
[mmh] / sbr / putenv.c
index a2ec7d3..54c4068 100644 (file)
@@ -25,7 +25,7 @@ m_putenv(char *name, char *value)
        int i;
        char **ep, **nep, *cp;
 
-       cp = mh_xmalloc((size_t) (strlen(name) + strlen(value) + 2));
+       cp = mh_xcalloc((size_t) (strlen(name) + strlen(value) + 2), sizeof(char));
 
        sprintf(cp, "%s=%s", name, value);
 
@@ -35,7 +35,7 @@ m_putenv(char *name, char *value)
                        return 0;
                }
 
-       nep = (char **) mh_xmalloc((size_t) ((i + 2) * sizeof(*nep)));
+       nep = (char **) mh_xcalloc((size_t) (i + 2), sizeof(*nep));
 
        for (ep = environ, i = 0; *ep; nep[i++] = *ep++)
                continue;