summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-11-11 14:34:46 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-11-11 16:12:01 +0100
commit7c765ea14785a4ad6efd2e30e03447f354bed6b4 (patch)
tree8c1e3836d1c907378f61bb5748aac4219af68ce4
parent5c0edceec3a939ce7804b23beaeebfc700413489 (diff)
No need for osd_malloc, osd_malloc_array and osd_free (nw)
MALLOC_DEBUG not applicable anymore since we use new to allocate in 99.9% of cases
-rw-r--r--scripts/src/osd/sdl_cfg.lua4
-rw-r--r--scripts/src/osd/windows_cfg.lua5
-rw-r--r--src/devices/cpu/psx/dismips.cpp28
-rw-r--r--src/devices/machine/ram.cpp2
-rw-r--r--src/frontend/mame/media_ident.cpp2
-rw-r--r--src/frontend/mame/ui/ui.cpp4
-rw-r--r--src/lib/util/corefile.cpp2
-rw-r--r--src/lib/util/corestr.cpp4
-rw-r--r--src/lib/util/corestr.h2
-rw-r--r--src/mame/machine/gaelco3d.cpp20
-rw-r--r--src/osd/modules/file/posixfile.cpp2
-rw-r--r--src/osd/modules/file/stdfile.cpp2
-rw-r--r--src/osd/modules/lib/osdlib.h5
-rw-r--r--src/osd/modules/lib/osdlib_macosx.cpp44
-rw-r--r--src/osd/modules/lib/osdlib_unix.cpp43
-rw-r--r--src/osd/modules/lib/osdlib_uwp.cpp30
-rw-r--r--src/osd/modules/lib/osdlib_win32.cpp97
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp2
-rw-r--r--src/osd/osdcore.h53
-rw-r--r--src/tools/imgtool/charconv.cpp4
-rw-r--r--src/tools/imgtool/imgtool.cpp22
-rw-r--r--src/tools/regrep.cpp2
-rw-r--r--src/tools/split.cpp4
-rw-r--r--src/tools/src2html.cpp2
-rw-r--r--src/tools/unidasm.cpp2
25 files changed, 44 insertions, 343 deletions
diff --git a/scripts/src/osd/sdl_cfg.lua b/scripts/src/osd/sdl_cfg.lua
index 4c7c5d4e225..b8f24d27d3b 100644
--- a/scripts/src/osd/sdl_cfg.lua
+++ b/scripts/src/osd/sdl_cfg.lua
@@ -111,10 +111,6 @@ if _OPTIONS["targetos"]=="windows" then
"_WIN32_WINNT=0x0501",
}
- configuration { "Debug" }
- defines {
- "MALLOC_DEBUG",
- }
configuration { }
elseif _OPTIONS["targetos"]=="linux" then
diff --git a/scripts/src/osd/windows_cfg.lua b/scripts/src/osd/windows_cfg.lua
index b7636e5b435..1ba0efe6151 100644
--- a/scripts/src/osd/windows_cfg.lua
+++ b/scripts/src/osd/windows_cfg.lua
@@ -12,11 +12,6 @@ configuration { "mingw* or vs*" }
"main=utf8_main",
}
-configuration { "Debug" }
- defines {
- "MALLOC_DEBUG",
- }
-
configuration { "vs*" }
flags {
"Unicode",
diff --git a/src/devices/cpu/psx/dismips.cpp b/src/devices/cpu/psx/dismips.cpp
index bfbc3428c94..09b14d9d06b 100644
--- a/src/devices/cpu/psx/dismips.cpp
+++ b/src/devices/cpu/psx/dismips.cpp
@@ -331,31 +331,3 @@ int main( int argc, char *argv[] )
free (filebuf);
return 0;
}
-
-void *osd_malloc_array(size_t size)
-{
- return osd_malloc(size);
-}
-
-void *malloc_array_file_line(size_t size, const char *file, int line)
-{
- // allocate the memory and fail if we can't
- return osd_malloc_array(size);
-}
-
-void free_file_line( void *memory, const char *file, int line )
-{
- osd_free( memory );
-}
-
-void osd_free( void *memory )
-{
-#undef free
- free( memory );
-}
-
-void *osd_malloc( size_t size )
-{
-#undef malloc
- return malloc( size );
-}
diff --git a/src/devices/machine/ram.cpp b/src/devices/machine/ram.cpp
index f651e10c8bc..6f401178658 100644
--- a/src/devices/machine/ram.cpp
+++ b/src/devices/machine/ram.cpp
@@ -129,7 +129,7 @@ void ram_device::device_validity_check(validity_checker &valid) const
p += 1;
}
- osd_free(s);
+ free(s);
}
} else {
diff --git a/src/frontend/mame/media_ident.cpp b/src/frontend/mame/media_ident.cpp
index 5e975be8d4b..1360a88c66c 100644
--- a/src/frontend/mame/media_ident.cpp
+++ b/src/frontend/mame/media_ident.cpp
@@ -157,7 +157,7 @@ void media_identifier::identify_file(const char *name)
if (filerr == osd_file::error::NONE && length > 0)
{
identify_data(name, reinterpret_cast<uint8_t *>(data), length);
- osd_free(data);
+ free(data);
}
}
}
diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp
index 315da7763a5..d7bf97a6562 100644
--- a/src/frontend/mame/ui/ui.cpp
+++ b/src/frontend/mame/ui/ui.cpp
@@ -900,7 +900,7 @@ bool mame_ui_manager::can_paste()
// free the string if allocated
if (text != nullptr)
- osd_free(text);
+ free(text);
// did we have text?
return text != nullptr;
@@ -923,7 +923,7 @@ void mame_ui_manager::paste()
machine().ioport().natkeyboard().post_utf8(text);
// free the string
- osd_free(text);
+ free(text);
}
}
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp
index 76b788174ab..264d80f4113 100644
--- a/src/lib/util/corefile.cpp
+++ b/src/lib/util/corefile.cpp
@@ -1207,7 +1207,7 @@ osd_file::error core_file::load(std::string const &filename, void **data, std::u
return osd_file::error::OUT_OF_MEMORY;
// allocate memory
- *data = osd_malloc(size);
+ *data = malloc(size);
length = std::uint32_t(size);
// read the data
diff --git a/src/lib/util/corestr.cpp b/src/lib/util/corestr.cpp
index ed9c8e77b0a..4431f6d08ac 100644
--- a/src/lib/util/corestr.cpp
+++ b/src/lib/util/corestr.cpp
@@ -109,7 +109,7 @@ int core_strwildcmp(const char *sp1, const char *sp2)
/*-------------------------------------------------
- core_strdup - string duplication via osd_malloc
+ core_strdup - string duplication via malloc
-------------------------------------------------*/
char *core_strdup(const char *str)
@@ -117,7 +117,7 @@ char *core_strdup(const char *str)
char *cpy = nullptr;
if (str != nullptr)
{
- cpy = (char *)osd_malloc_array(strlen(str) + 1);
+ cpy = (char *)malloc(strlen(str) + 1);
if (cpy != nullptr)
strcpy(cpy, str);
}
diff --git a/src/lib/util/corestr.h b/src/lib/util/corestr.h
index 29f98d06dc6..1e12c0d0e24 100644
--- a/src/lib/util/corestr.h
+++ b/src/lib/util/corestr.h
@@ -49,7 +49,7 @@ int core_strnicmp(const char *s1, const char *s2, size_t n);
#define strncasecmp MUST_USE_CORE_STRNICMP_INSTEAD
-/* since strdup is not part of the standard, we use this instead - free with osd_free() */
+/* since strdup is not part of the standard, we use this instead - free with free() */
char *core_strdup(const char *str);
/* this macro prevents people from using strdup directly */
diff --git a/src/mame/machine/gaelco3d.cpp b/src/mame/machine/gaelco3d.cpp
index 18f0322d019..a3b881fb89f 100644
--- a/src/mame/machine/gaelco3d.cpp
+++ b/src/mame/machine/gaelco3d.cpp
@@ -85,11 +85,11 @@
static osd_shared_mem *osd_sharedmem_alloc(const char *path, int create, size_t size)
{
int fd;
- osd_shared_mem *os_shmem = (osd_shared_mem *) osd_malloc(sizeof(osd_shared_mem));
+ osd_shared_mem *os_shmem = (osd_shared_mem *)malloc(sizeof(osd_shared_mem));
if (create)
{
- char *buf = (char *) osd_malloc_array(size);
+ char *buf = (char *) malloc(size);
memset(buf,0, size);
fd = open(path, O_RDWR | O_CREAT, S_IRWXU);
@@ -101,12 +101,12 @@ static osd_shared_mem *osd_sharedmem_alloc(const char *path, int create, size_t
fd = open(path, O_RDWR);
if (fd == -1)
{
- osd_free(os_shmem);
+ free(os_shmem);
return nullptr;
}
os_shmem->creator = 0;
}
- os_shmem->fn = (char *) osd_malloc_array(strlen(path)+1);
+ os_shmem->fn = (char *) malloc(strlen(path)+1);
strcpy(os_shmem->fn, path);
assert(fd != -1);
@@ -122,8 +122,8 @@ static void osd_sharedmem_free(osd_shared_mem *os_shmem)
munmap(os_shmem->ptr, os_shmem->size);
if (os_shmem->creator)
unlink(os_shmem->fn);
- osd_free(os_shmem->fn);
- osd_free(os_shmem);
+ free(os_shmem->fn);
+ free(os_shmem);
}
static void *osd_sharedmem_ptr(osd_shared_mem *os_shmem)
@@ -133,19 +133,19 @@ static void *osd_sharedmem_ptr(osd_shared_mem *os_shmem)
#else
static osd_shared_mem *osd_sharedmem_alloc(const char *path, int create, size_t size)
{
- osd_shared_mem *os_shmem = (osd_shared_mem *) osd_malloc(sizeof(osd_shared_mem));
+ osd_shared_mem *os_shmem = (osd_shared_mem *) malloc(sizeof(osd_shared_mem));
os_shmem->creator = 0;
- os_shmem->ptr = (void *) osd_malloc_array(size);
+ os_shmem->ptr = (void *) malloc(size);
os_shmem->size = size;
return os_shmem;
}
static void osd_sharedmem_free(osd_shared_mem *os_shmem)
{
- osd_free(os_shmem->ptr);
- osd_free(os_shmem);
+ free(os_shmem->ptr);
+ free(os_shmem);
}
static void *osd_sharedmem_ptr(osd_shared_mem *os_shmem)
diff --git a/src/osd/modules/file/posixfile.cpp b/src/osd/modules/file/posixfile.cpp
index 5b90e43a57c..3cc122342dd 100644
--- a/src/osd/modules/file/posixfile.cpp
+++ b/src/osd/modules/file/posixfile.cpp
@@ -276,7 +276,7 @@ osd_file::error osd_file::open(std::string const &path, std::uint32_t openflags,
}
}
- // if we still failed, clean up and osd_free
+ // if we still failed, clean up and free
if (fd < 0)
{
return errno_to_file_error(errno);
diff --git a/src/osd/modules/file/stdfile.cpp b/src/osd/modules/file/stdfile.cpp
index 611775ab0ba..cb1f1b536b2 100644
--- a/src/osd/modules/file/stdfile.cpp
+++ b/src/osd/modules/file/stdfile.cpp
@@ -197,7 +197,7 @@ osd_directory_entry *osd_stat(const std::string &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_array(sizeof(*result) + path.length() + 1);
+ result = (osd_directory_entry *)malloc(sizeof(*result) + path.length() + 1);
strcpy((char *)(result + 1), path.c_str());
result->name = (char *)(result + 1);
result->type = ENTTYPE_NONE;
diff --git a/src/osd/modules/lib/osdlib.h b/src/osd/modules/lib/osdlib.h
index 17f341b8934..7580c92dedd 100644
--- a/src/osd/modules/lib/osdlib.h
+++ b/src/osd/modules/lib/osdlib.h
@@ -11,9 +11,6 @@
//
// - osd_ticks
// - osd_sleep
-// - osd_malloc
-// - osd_malloc_array
-// - osd_free
//============================================================
#ifndef __OSDLIB__
@@ -60,7 +57,7 @@ int osd_setenv(const char *name, const char *value, int overwrite);
Return value:
- the returned string needs to be osd_free()-ed!
+ the returned string needs to be free-ed!
-----------------------------------------------------------------------------*/
char *osd_get_clipboard_text(void);
diff --git a/src/osd/modules/lib/osdlib_macosx.cpp b/src/osd/modules/lib/osdlib_macosx.cpp
index 94b935de08d..0d353531b0d 100644
--- a/src/osd/modules/lib/osdlib_macosx.cpp
+++ b/src/osd/modules/lib/osdlib_macosx.cpp
@@ -58,48 +58,6 @@ void osd_process_kill()
}
//============================================================
-// osd_malloc
-//============================================================
-
-void *osd_malloc(size_t size)
-{
-#ifndef MALLOC_DEBUG
- return malloc(size);
-#else
-#error "MALLOC_DEBUG not yet supported"
-#endif
-}
-
-
-//============================================================
-// 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
-//============================================================
-
-void osd_free(void *ptr)
-{
-#ifndef MALLOC_DEBUG
- free(ptr);
-#else
-#error "MALLOC_DEBUG not yet supported"
-#endif
-}
-
-
-//============================================================
// osd_alloc_executable
//
// allocates "size" bytes of executable memory. this must take
@@ -205,7 +163,7 @@ char *osd_get_clipboard_text(void)
CFIndex const length = CFDataGetLength(data_ref);
CFRange const range = CFRangeMake(0, length);
- result = reinterpret_cast<char *>(osd_malloc_array(length + 1));
+ result = reinterpret_cast<char *>(malloc(length + 1));
if (result)
{
CFDataGetBytes(data_ref, range, reinterpret_cast<unsigned char *>(result));
diff --git a/src/osd/modules/lib/osdlib_unix.cpp b/src/osd/modules/lib/osdlib_unix.cpp
index 054c4591f71..f6e892455f8 100644
--- a/src/osd/modules/lib/osdlib_unix.cpp
+++ b/src/osd/modules/lib/osdlib_unix.cpp
@@ -56,47 +56,6 @@ void osd_process_kill()
}
//============================================================
-// osd_malloc
-//============================================================
-
-void *osd_malloc(size_t size)
-{
-#ifndef MALLOC_DEBUG
- return malloc(size);
-#else
-#error "MALLOC_DEBUG not yet supported"
-#endif
-}
-
-
-//============================================================
-// 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
-//============================================================
-
-void osd_free(void *ptr)
-{
-#ifndef MALLOC_DEBUG
- free(ptr);
-#else
-#error "MALLOC_DEBUG not yet supported"
-#endif
-}
-
-//============================================================
// osd_alloc_executable
//
// allocates "size" bytes of executable memory. this must take
@@ -160,7 +119,7 @@ char *osd_get_clipboard_text(void)
if (SDL_HasClipboardText())
{
char *temp = SDL_GetClipboardText();
- result = (char *) osd_malloc_array(strlen(temp) + 1);
+ result = (char *) malloc(strlen(temp) + 1);
strcpy(result, temp);
SDL_free(temp);
}
diff --git a/src/osd/modules/lib/osdlib_uwp.cpp b/src/osd/modules/lib/osdlib_uwp.cpp
index 344418e7efb..87e3a56e0d6 100644
--- a/src/osd/modules/lib/osdlib_uwp.cpp
+++ b/src/osd/modules/lib/osdlib_uwp.cpp
@@ -112,36 +112,6 @@ void osd_process_kill()
}
//============================================================
-// osd_malloc
-//============================================================
-
-void *osd_malloc(size_t size)
-{
- return malloc(size);
-}
-
-
-//============================================================
-// osd_malloc_array
-//============================================================
-
-void *osd_malloc_array(size_t size)
-{
- return malloc(size);
-}
-
-
-//============================================================
-// osd_free
-//============================================================
-
-void osd_free(void *ptr)
-{
- free(ptr);
-}
-
-
-//============================================================
// osd_alloc_executable
//
// allocates "size" bytes of executable memory. this must take
diff --git a/src/osd/modules/lib/osdlib_win32.cpp b/src/osd/modules/lib/osdlib_win32.cpp
index d75bbea87e4..8760d4be9a3 100644
--- a/src/osd/modules/lib/osdlib_win32.cpp
+++ b/src/osd/modules/lib/osdlib_win32.cpp
@@ -84,7 +84,7 @@ int osd_setenv(const char *name, const char *value, int overwrite)
if (osd_getenv(name) != nullptr)
return 0;
}
- buf = (char *) osd_malloc_array(strlen(name)+strlen(value)+2);
+ buf = (char *) malloc(strlen(name)+strlen(value)+2);
sprintf(buf, "%s=%s", name, value);
result = putenv(buf);
@@ -107,99 +107,6 @@ void osd_process_kill()
}
//============================================================
-// osd_malloc
-//============================================================
-
-void *osd_malloc(size_t size)
-{
-#ifndef MALLOC_DEBUG
- return malloc(size);
-#else
- // add in space for the size and offset
- size += MAX_ALIGNMENT + sizeof(size_t) + 2;
- size &= ~size_t(1);
-
- // basic objects just come from the heap
- uint8_t *const block = reinterpret_cast<uint8_t *>(HeapAlloc(GetProcessHeap(), 0, size));
- if (block == nullptr)
- return nullptr;
- uint8_t *const result = reinterpret_cast<uint8_t *>(reinterpret_cast<uintptr_t>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1));
-
- // store the size and return and pointer to the data afterward
- *reinterpret_cast<size_t *>(block) = size;
- *(result - 1) = result - block;
- return result;
-#endif
-}
-
-
-//============================================================
-// osd_malloc_array
-//============================================================
-
-void *osd_malloc_array(size_t size)
-{
-#ifndef MALLOC_DEBUG
- return malloc(size);
-#else
- // add in space for the size and offset
- size += MAX_ALIGNMENT + sizeof(size_t) + 2;
- size &= ~size_t(1);
-
- // round the size up to a page boundary
- size_t const rounded_size = ((size + sizeof(void *) + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE;
-
- // reserve that much memory, plus two guard pages
- void *page_base = VirtualAlloc(nullptr, rounded_size + 2 * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
- if (page_base == nullptr)
- return nullptr;
-
- // now allow access to everything but the first and last pages
- page_base = VirtualAlloc(reinterpret_cast<uint8_t *>(page_base) + PAGE_SIZE, rounded_size, MEM_COMMIT, PAGE_READWRITE);
- if (page_base == nullptr)
- return nullptr;
-
- // work backwards from the page base to get to the block base
- uint8_t *const block = GUARD_ALIGN_START ? reinterpret_cast<uint8_t *>(page_base) : (reinterpret_cast<uint8_t *>(page_base) + rounded_size - size);
- uint8_t *const result = reinterpret_cast<uint8_t *>(reinterpret_cast<uintptr_t>(block + sizeof(size_t) + MAX_ALIGNMENT) & ~(uintptr_t(MAX_ALIGNMENT) - 1));
-
- // store the size at the start with a flag indicating it has a guard page
- *reinterpret_cast<size_t *>(block) = size | 1;
- *(result - 1) = result - block;
- return result;
-#endif
-}
-
-
-//============================================================
-// osd_free
-//============================================================
-
-void osd_free(void *ptr)
-{
-#ifndef MALLOC_DEBUG
- free(ptr);
-#else
- uint8_t const offset = *(reinterpret_cast<uint8_t *>(ptr) - 1);
- uint8_t *const block = reinterpret_cast<uint8_t *>(ptr) - offset;
- size_t const size = *reinterpret_cast<size_t *>(block);
-
- if ((size & 0x1) == 0)
- {
- // if no guard page, just free the pointer
- HeapFree(GetProcessHeap(), 0, block);
- }
- else
- {
- // large items need more care
- ULONG_PTR const page_base = reinterpret_cast<ULONG_PTR>(block) & ~(PAGE_SIZE - 1);
- VirtualFree(reinterpret_cast<void *>(page_base - PAGE_SIZE), 0, MEM_RELEASE);
- }
-#endif
-}
-
-
-//============================================================
// osd_alloc_executable
//
// allocates "size" bytes of executable memory. this must take
@@ -275,7 +182,7 @@ static char *get_clipboard_text_by_format(UINT format, std::string (*convert)(LP
std::string s = (*convert)(data);
// copy the string
- result = (char *) osd_malloc(s.size() + 1);
+ result = (char *) malloc(s.size() + 1);
if (result != nullptr)
memcpy(result, s.data(), (s.size() + 1) * sizeof(*result));
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index e9ab4f76060..3f4763626fa 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -193,7 +193,7 @@ osd_common_t::osd_common_t(osd_options &options)
osd_common_t::~osd_common_t()
{
for(unsigned int i= 0; i < m_video_names.size(); ++i)
- osd_free(const_cast<char*>(m_video_names[i]));
+ free(const_cast<char*>(m_video_names[i]));
//m_video_options,reset();
osd_output::pop(this);
}
diff --git a/src/osd/osdcore.h b/src/osd/osdcore.h
index 5a2422e50f9..c22bfd03800 100644
--- a/src/osd/osdcore.h
+++ b/src/osd/osdcore.h
@@ -685,59 +685,6 @@ void osd_work_item_release(osd_work_item *item);
***************************************************************************/
/*-----------------------------------------------------------------------------
- osd_malloc: allocate memory
-
- Parameters:
-
- size - the number of bytes to allocate
-
- Return value:
-
- a pointer to the allocated memory
-
- Notes:
-
- This is just a hook to do OS-specific allocation trickery.
- It can be safely written as a wrapper to malloc().
------------------------------------------------------------------------------*/
-void *osd_malloc(size_t size);
-
-
-/*-----------------------------------------------------------------------------
- osd_malloc_array: allocate memory, hinting tha this memory contains an
- array
-
- Parameters:
-
- size - the number of bytes to allocate
-
- Return value:
-
- a pointer to the allocated memory
-
- Notes:
-
- This is just a hook to do OS-specific allocation trickery.
- It can be safely written as a wrapper to malloc().
------------------------------------------------------------------------------*/
-void *osd_malloc_array(size_t size);
-
-
-/*-----------------------------------------------------------------------------
- osd_free: free memory allocated by osd_malloc
-
- Parameters:
-
- ptr - the pointer returned from osd_mallo
-
- Return value:
-
- None
------------------------------------------------------------------------------*/
-void osd_free(void *ptr);
-
-
-/*-----------------------------------------------------------------------------
osd_alloc_executable: allocate memory that can contain executable code
Parameters:
diff --git a/src/tools/imgtool/charconv.cpp b/src/tools/imgtool/charconv.cpp
index 34a912dcb89..a57d15e1a73 100644
--- a/src/tools/imgtool/charconv.cpp
+++ b/src/tools/imgtool/charconv.cpp
@@ -28,7 +28,7 @@ static char *utf8_from_latin1(const char *src)
}
/* allocate space for result, twice the source len to be safe */
- buffer = (char *) osd_malloc(strlen(src) * 2 + 1);
+ buffer = (char *) malloc(strlen(src) * 2 + 1);
/* point to the start */
bufptr = buffer;
@@ -73,7 +73,7 @@ static char *latin1_from_utf8(const char *src)
}
/* allocate space for result */
- buffer = (char *) osd_malloc(strlen(src) + 1);
+ buffer = (char *) malloc(strlen(src) + 1);
/* point to the start */
bufptr = buffer;
diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp
index 57a702dd17b..417c9304caa 100644
--- a/src/tools/imgtool/imgtool.cpp
+++ b/src/tools/imgtool/imgtool.cpp
@@ -1332,7 +1332,7 @@ done:
if (alloc_path != nullptr)
free(alloc_path);
if (new_fname != nullptr)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -1376,7 +1376,7 @@ done:
if (alloc_path != nullptr)
free(alloc_path);
if (new_fname != nullptr)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -1481,7 +1481,7 @@ done:
if (alloc_path)
free(alloc_path);
if (new_fname)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -1920,7 +1920,7 @@ done:
if (alloc_dest != nullptr)
free(alloc_dest);
if (new_fname != nullptr)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -1968,7 +1968,7 @@ imgtoolerr_t imgtool::partition::put_file(const char *newfname, const char *fork
done:
/* clean up */
if (alloc_newfname != nullptr)
- osd_free(alloc_newfname);
+ free(alloc_newfname);
return err;
}
@@ -2016,7 +2016,7 @@ done:
if (alloc_path)
free(alloc_path);
if (new_fname)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -2060,7 +2060,7 @@ done:
if (alloc_path)
free(alloc_path);
if (new_fname)
- osd_free(new_fname);
+ free(new_fname);
return err;
}
@@ -2105,7 +2105,7 @@ done:
if (alloc_path)
free(alloc_path);
if (new_path)
- osd_free(new_path);
+ free(new_path);
return err;
}
@@ -2150,7 +2150,7 @@ done:
if (alloc_path)
free(alloc_path);
if (new_path)
- osd_free(new_path);
+ free(new_path);
return err;
}
@@ -2466,7 +2466,7 @@ done:
if (alloc_path != nullptr)
free(alloc_path);
if (new_path != nullptr)
- osd_free(new_path);
+ free(new_path);
return err;
}
@@ -2509,7 +2509,7 @@ imgtoolerr_t imgtool::directory::get_next(imgtool_dirent &ent)
return IMGTOOLERR_BADFILENAME;
snprintf(ent.filename, ARRAY_LENGTH(ent.filename), "%s", new_fname);
- osd_free(new_fname);
+ free(new_fname);
}
// don't trust the module!
diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp
index b421d94190e..91dcaecd518 100644
--- a/src/tools/regrep.cpp
+++ b/src/tools/regrep.cpp
@@ -238,7 +238,7 @@ int main(int argc, char *argv[])
if (util::core_file::load(tempfilename.c_str(), &buffer, bufsize) == osd_file::error::NONE)
{
tempheader.assign((const char *)buffer, bufsize);
- osd_free(buffer);
+ free(buffer);
}
/* verify the template */
diff --git a/src/tools/split.cpp b/src/tools/split.cpp
index 886b95d2aa2..4ef18b6ad06 100644
--- a/src/tools/split.cpp
+++ b/src/tools/split.cpp
@@ -343,7 +343,7 @@ static int join_file(const char *filename, const char *outname, int write_output
printf(" verified\n");
// release allocated memory
- osd_free(splitbuffer);
+ free(splitbuffer);
splitbuffer = nullptr;
}
if (write_output)
@@ -366,7 +366,7 @@ cleanup:
remove(outfilename.c_str());
}
if (splitbuffer != nullptr)
- osd_free(splitbuffer);
+ free(splitbuffer);
return error;
}
diff --git a/src/tools/src2html.cpp b/src/tools/src2html.cpp
index 92b111c77d8..b6db0879057 100644
--- a/src/tools/src2html.cpp
+++ b/src/tools/src2html.cpp
@@ -282,7 +282,7 @@ int main(int argc, char *argv[])
if (util::core_file::load(tempfilename.c_str(), &buffer, bufsize) == osd_file::error::NONE)
{
tempheader.assign((const char *)buffer, bufsize);
- osd_free(buffer);
+ free(buffer);
}
// verify the template
diff --git a/src/tools/unidasm.cpp b/src/tools/unidasm.cpp
index f72a5734f23..19a1fa116c4 100644
--- a/src/tools/unidasm.cpp
+++ b/src/tools/unidasm.cpp
@@ -707,7 +707,7 @@ int main(int argc, char *argv[])
result = 1;
}
- osd_free(data);
+ free(data);
return result;
}