* patch #3966: Create a mh_xmalloc function to prevent mistakes when
[mmh] / sbr / strdup.c
index 486b36a..ebc29f5 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <h/mh.h>
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 
 
 char *
 
 
 char *
@@ -22,8 +23,7 @@ strdup (const char *str)
        return NULL;
 
     len = strlen(str) + 1;
        return NULL;
 
     len = strlen(str) + 1;
-    if (!(cp = malloc (len)))
-       return NULL;
+    cp = mh_xmalloc (len);
     memcpy (cp, str, len);
     return cp;
 }
     memcpy (cp, str, len);
     return cp;
 }