Previous 15994 Revisions Next

r2365 Saturday 12th April, 2008 at 03:06:49 UTC by Nathan Woods
Fixed memory bug in the hash file parsing code that could cause problems in
debug builds.
[docs]messnew.txt
[src/mess]hashfile.c

src/mess/hashfile.c
r2364r2365
1111#include "expat.h"
1212
1313
14
1415/***************************************************************************
15
16   Type definitions
17
16    TYPE DEFINITIONS
1817***************************************************************************/
1918
2019struct _hash_file
r2364r2365
5958
6059
6160/***************************************************************************
61    PROTOTYPES
62***************************************************************************/
6263
63   Functions
64static void *expat_malloc(size_t size);
65static void *expat_realloc(void *ptr, size_t size);
66static void expat_free(void *ptr);
6467
68
69
70/***************************************************************************
71    CORE IMPLEMENTATION
6572***************************************************************************/
6673
6774static void ATTR_PRINTF(2,3) parse_error(struct hash_parse_state *state, const char *fmt, ...)
r2364r2365
296303   struct hash_parse_state state;
297304   char buf[1024];
298305   UINT32 len;
306   XML_Memory_Handling_Suite memcallbacks;
299307
300308   mame_fseek(hashfile->file, 0, SEEK_SET);
301309
r2364r2365
306314   state.error_proc = error_proc;
307315   state.param = param;
308316
309   state.parser = XML_ParserCreate(NULL);
317   /* create the XML parser */
318   memcallbacks.malloc_fcn = expat_malloc;
319   memcallbacks.realloc_fcn = expat_realloc;
320   memcallbacks.free_fcn = expat_free;
321   state.parser = XML_ParserCreate_MM(NULL, &memcallbacks, NULL);
310322   if (!state.parser)
311323      goto done;
312324
r2364r2365
481493   return 0;
482494}
483495
496
497
498/***************************************************************************
499    EXPAT INTERFACES
500***************************************************************************/
501
502/*-------------------------------------------------
503    expat_malloc/expat_realloc/expat_free -
504    wrappers for memory allocation functions so
505    that they pass through out memory tracking
506    systems
507-------------------------------------------------*/
508
509static void *expat_malloc(size_t size)
510{
511   return malloc(size);
512}
513
514static void *expat_realloc(void *ptr, size_t size)
515{
516   return realloc(ptr, size);
517}
518
519static void expat_free(void *ptr)
520{
521   free(ptr);
522}
docs/messnew.txt
r2364r2365
7474 
7575- Converted printers to the new device system.  [Nate Woods]
7676
77- Fixed memory bug in the hash file parsing code that could cause problems in
78  debug builds.  [Nate Woods]
7779
7880
81
79820.124a
8083
8184New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team