Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category Games
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Daniel WECK - 2007-09-09
Last edited by Jonathan Gordon - 2008-08-19

FS#7740 - Chess:error in pl_malloc,missing update of remaining size in plugin buffer for pseudo dynamic alloc.

In 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;
  }


Closed by  Jonathan Gordon
2008-08-19 12:16
Reason for closing:  Accepted
Additional comments about closing:  

thanks :)

Daniel WECK commented on 2007-09-09 20:27

I forgot to say: this code is copied from dict.c, so the both the Chess and Dict plugins are affected by this.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing