Renamed stacktrace to memtrace
[runtime.git] / lib / silcutil / silcmemory.c
index b1a657b2f335593c91bba82875d9e2ea1d8fb8f6..082ac06d4953eba80b0cf2d49993e0e80a9faa34 100644 (file)
   GNU General Public License for more details.
 
 */
-/* $Id$ */
 
-#include "silc.h"
+#include "silcruntime.h"
 
-#ifndef SILC_STACKTRACE
+#ifndef SILC_MEMTRACE
 
 #define SILC_MAX_ALLOC (1024 * 1024L * 1024L)
 
@@ -107,7 +106,7 @@ char *silc_strdup(const char *str)
   return silc_memdup(str, strlen(str));
 }
 
-#endif /* !SILC_STACKTRACE */
+#endif /* !SILC_MEMTRACE */
 
 /* SilcStack aware routines */
 
@@ -155,7 +154,7 @@ void *silc_srealloc(SilcStack stack, SilcUInt32 old_size,
     new_ptr = silc_smalloc(stack, size);
     if (!new_ptr)
       return NULL;
-    memcpy(new_ptr, ptr, old_size);
+    memcpy(new_ptr, ptr, old_size > size ? size : old_size);
   }
 
   return new_ptr;