Realloc() problem with Efence

Nicholas T Ingolia ingolia at MIT.EDU
Thu Jul 29 06:03:39 EST 1999


-----BEGIN PGP SIGNED MESSAGE-----

Hello...

realloc() may move the memory being realloated.  To quote from the man page,

       realloc() returns a pointer to the newly allocated memory,
       which is suitably aligned for any kind of variable and may
       be  different from ptr...

It doesn't (and couldn't) mutate the pointer temp_c_buf directly.

Thus, you probably want to re-write your code to do

temp_c_buf = realloc(temp_c_buf, 5000 + 5000);

- --Nicholas Ingolia
ingolia at mit.edu
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Comment: Processed by Mailcrypt 3.5.3, an Emacs/PGP interface
Charset: noconv

iQCVAwUBN59h+gRHXKx72OUhAQEkNAP/bYZO+zzGI2bDBRuCYabEfaxo8/EAffTN
hliGzKLwhhEetuvrUNv+pam5qBXGb3OLWWAZdRmypEvPXfYP/w3wGlJlGKWxAbGm
WhBJkzwVWEkqKmqADiClP7ucJcMIYkMcLLVcCBnVEsjoPFDumoc2ncEe6beeRDIB
gma/mrLVmZs=
=tyhG
-----END PGP SIGNATURE-----

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]





More information about the Linuxppc-dev mailing list