diff options
Diffstat (limited to 'src/osd/sdl/sdlos_macosx.c')
-rw-r--r-- | src/osd/sdl/sdlos_macosx.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/osd/sdl/sdlos_macosx.c b/src/osd/sdl/sdlos_macosx.c index baa8ac2d167..c37eb8ad726 100644 --- a/src/osd/sdl/sdlos_macosx.c +++ b/src/osd/sdl/sdlos_macosx.c @@ -177,6 +177,20 @@ void *osd_malloc(size_t size) //============================================================ +// osd_malloc_array +//============================================================ + +void *osd_malloc_array(size_t size) +{ +#ifndef MALLOC_DEBUG + return malloc(size); +#else +#error "MALLOC_DEBUG not yet supported" +#endif +} + + +//============================================================ // osd_free //============================================================ @@ -277,7 +291,7 @@ char *osd_get_clipboard_text(void) length = CFDataGetLength (data_ref); range = CFRangeMake (0,length); - result = (char *)osd_malloc (length+1); + result = (char *)osd_malloc_array (length+1); if (result != NULL) { CFDataGetBytes (data_ref, range, (unsigned char *)result); @@ -330,7 +344,7 @@ osd_directory_entry *osd_stat(const char *path) // create an osd_directory_entry; be sure to make sure that the caller can // free all resources by just freeing the resulting osd_directory_entry - result = (osd_directory_entry *) osd_malloc(sizeof(*result) + strlen(path) + 1); + result = (osd_directory_entry *) osd_malloc_array(sizeof(*result) + strlen(path) + 1); strcpy(((char *) result) + sizeof(*result), path); result->name = ((char *) result) + sizeof(*result); result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE; @@ -367,7 +381,7 @@ file_error osd_get_full_path(char **dst, const char *path) } else { - *dst = (char *)osd_malloc(strlen(path_buffer)+strlen(path)+3); + *dst = (char *)osd_malloc_array(strlen(path_buffer)+strlen(path)+3); // if it's already a full path, just pass it through if (path[0] == '/') |