www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/07/28/15:24:46

Message-ID: <35BE4178.833A7F80@gmx.net>
Date: Tue, 28 Jul 1998 21:24:08 +0000
From: Robert Hoehne <robert DOT hoehne AT gmx DOT net>
Organization: none provided
MIME-Version: 1.0
To: djgpp-workers <djgpp-workers AT delorie DOT com>
Subject: Very strange bug in re(f)malloc()

This bug is very easy to fix, but very hard to find :-)

BTW: It was applied after the other here posted patch,
so you will get a fuzzy offset warning when applying to
the original alpha source (also the last 0726).

--- src/libc/ansi/stdlib/fmalloc.c~	Tue Jul 28 21:05:58 1998
+++ src/libc/ansi/stdlib/fmalloc.c	Tue Jul 28 21:06:14 1998
@@ -81,7 +81,7 @@
   if (size <= oldsize)
     return ptr;
   newptr = (char *)malloc(size);
-  memcpy(ptr, newptr, oldsize);
+  memcpy(newptr, ptr, oldsize);
   free(ptr);
   return newptr;
 }

-- 
******************************************************
* email:   Robert Hoehne <robert DOT hoehne AT gmx DOT net>     *
* Post:    Am Berg 3, D-09573 Dittmannsdorf, Germany *
* WWW:     http://www.tu-chemnitz.de/~sho/rho        *
******************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019