This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#7740 - Chess:error in pl_malloc,missing update of remaining size in plugin buffer for pseudo dynamic alloc.
Attached to Project:
Rockbox
Opened by Daniel WECK (daniel.weck) - Sunday, 09 September 2007, 22:06 GMT+2
Last edited by Jonathan Gordon (jdgordon) - Tuesday, 19 August 2008, 14:16 GMT+2
Opened by Daniel WECK (daniel.weck) - Sunday, 09 September 2007, 22:06 GMT+2
Last edited by Jonathan Gordon (jdgordon) - Tuesday, 19 August 2008, 14:16 GMT+2
|
DetailsIn chessbox_pgn.c, the bufleft variable is never updated to reflect the actual size left in the plugin buffer for pseudo dynamic allocation. The original code is:
--------- /* global vars for pl_malloc() */ void *bufptr = NULL; ssize_t bufleft; /* simple function to "allocate" memory in pluginbuffer. * (borrowed from dict.c) */ void *pl_malloc(ssize_t size) { void *ptr; ptr = bufptr; if (bufleft < size) { return NULL; } else { bufptr += size; return ptr; } } /* init function for pl_malloc() */ void pl_malloc_init(void) { bufptr = rb->plugin_get_buffer((size_t *)&bufleft); } --------- In pl_malloc(), the bufleft variable should be updated as such: --------- ... else { bufptr += size; >>>>>>>> bufleft -= size; return ptr; } ... --------- |
This task depends upon
Closed by Jonathan Gordon (jdgordon)
Tuesday, 19 August 2008, 14:16 GMT+2
Reason for closing: Accepted
Additional comments about closing: thanks :)
Tuesday, 19 August 2008, 14:16 GMT+2
Reason for closing: Accepted
Additional comments about closing: thanks :)
I forgot to say: this code is copied from dict.c, so the both the Chess and Dict plugins are affected by this.