X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3C3B6547.24091B7E@phekda.freeserve.co.uk> Date: Tue, 08 Jan 2002 21:31:51 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Memory leaks fixes References: <200201051512 DOT QAA11293 AT father DOT ludd DOT luth DOT se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Martin Str|mberg wrote: > Isn't it bad practice to cast the return value from > malloc(). Shouldn't realloc() be treated the same? Yes, but I didn't understand why until I saw the quote below yesterday. Strange how this mail appeared in my inbox at work, when I was wondering why it's bad practice. ;) Casper Dik wrote on secprog AT securityfocus DOT com mailing list: "You should not cast the return value from malloc() in C. If you forget top include , the cast will suppress the warning from the compiler about converting an integer to a pointer. (And in a 64 bit Solaris app. the code would actually break)" I'll go through the library sources and check for bad casting with malloc() and realloc(). > Your mailer breaks lines. That's not good if you want us to apply the > patches. Sorry. I'll try to remember to use emacs to send them in the future. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]