* support/regression/collate-results.py: fixed output in case of a valdiag error
[fw/sdcc] / as / hc08 / lklibr.c
index 2481d9f02a8e312f005e6bdf83a2467b82b453bf..eb33beafd1c498e6ba64f928f0fa5c1767db785a 100644 (file)
 #define EQ(A,B) !strcmp((A),(B))
 #define MAXLINE 254 /*when using fgets*/
 
-#if defined(__APPLE__) && defined(__MACH__)
-#include <sys/types.h>
-#include <sys/malloc.h>
-#else
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -245,7 +237,7 @@ int addfile(char * path, char * libfil)
         That way putting 'path' and 'libfil' together will result into the original filepath
         as contained in 'str'.*/
         int j;
-        path = (char *) new (strlen(str));
+        path = (char *) new (strlen(str) + 1);
         strcpy(path, str);
         for(j=strlen(path)-1; j>=0; j--)
         {