work on type inference some more
[ccc.git] / util.c
diff --git a/util.c b/util.c
index efe22c7..fa60ddc 100644 (file)
--- a/util.c
+++ b/util.c
@@ -154,9 +154,11 @@ void *safe_malloc(size_t size)
 
 void *safe_strdup(const char *c)
 {
-       char *res = strdup(c);
+       size_t nchar = strlen(c);
+       char *res = malloc((nchar+1)*sizeof(char));
        if (res == NULL)
                pdie("strdup");
+       memcpy(res, c, nchar+1);
        return res;
 }