bartop

palmoswerks ARCHIVE
Palm OS programming tips from a (former) CodeWarrior insider

header

Navigation

Search
Home
About
Stories
Stuff I Like
Articles
PilRC
CodeWarrior
palmos.techwood.org
DevTools List
Palm OS Dev FAQ

MSL "realloc" bug in CWPalmOS 8.3

Author:   Ben Combee  
Posted: 8/23/02; 1:59:09 PM
Topic: MSL "realloc" bug in CWPalmOS 8.3
Msg #: 94 (top msg in thread)
Prev/Next: 93/95
Reads: 1152

Bug alert! Bug alert!

Here's a bug that escaped our code review in CW for Palm OS 8.3 when we fixed a problem with the realloc function. The file affected is "(MSL for Palm OS)\MSL_C++\MSL_Palm_OS\Include\cstdlib_Palm_OS".

In the definition of realloc, the last line of the code that handles the memErrChunkLocker error should be

return newPtr;

instead of

ptr = newPtr;

As currently implemented, if memory has to be reallocated, we will always immediately free the memory and return a NULL pointer. This is not what was intended, and we are sorry for the error.

Earlier versions of V8 didn't have this bug, but had a different bug in realloc that would affect almost any allocation.

Update: Core Wars for Palm OS

I was checking Palm Gaming World today, and I saw a new entry, PocketMARS. This is a freeware implementation of CoreWars for Palm OS, implementing multiple RedCode programs locked in battle. I've just downloaded the app, but haven't tried it out yet. Back in June, I wrote an article about this, so I'm pretty happy to see this appear.


Send feedback to combee@techwood.org
Copyright © 2004 Benjamin L. Combee
Palm OS is a registered trademark of PalmSource, Inc.
Metrowerks and CodeWarrior are registered trademarks of Metrowerks Inc.

The views expressed on this website/weblog are those of mine alone and do not necessarily reflect the views of PalmSource or Metrowerks.

This is a Manila Site

qwertYAK / frobnovich