@@ -109,7 +109,7 @@ static char* duplicate_string(const char* str)
109109 return NULL ;
110110 }
111111
112- char * dup = Dmod_Malloc (strlen (str ) + 1 );
112+ char * dup = Dmod_MallocEx (strlen (str ) + 1 , DMVFS_ALLOCATOR_NAME );
113113 if (dup != NULL )
114114 {
115115 strcpy (dup , str );
@@ -149,7 +149,7 @@ static char* normalize_path(const char* path)
149149 // Maximum possible components (each character could be a single-char component)
150150 // In practice: path_len / 2 + 1, but we use path_len for simplicity
151151 size_t max_components = path_len ;
152- char * * components = (char * * )Dmod_Malloc (sizeof (char * ) * max_components );
152+ char * * components = (char * * )Dmod_MallocEx (sizeof (char * ) * max_components , DMVFS_ALLOCATOR_NAME );
153153 if (components == NULL )
154154 {
155155 return NULL ;
@@ -169,7 +169,7 @@ static char* normalize_path(const char* path)
169169 if (len > 0 )
170170 {
171171 // Create a temporary buffer for the component
172- char * component = (char * )Dmod_Malloc (len + 1 );
172+ char * component = (char * )Dmod_MallocEx (len + 1 , DMVFS_ALLOCATOR_NAME );
173173 if (component == NULL )
174174 {
175175 // Cleanup on error
@@ -223,7 +223,7 @@ static char* normalize_path(const char* path)
223223 normalized_len += 1 + strlen (components [i ]); // '/' + component
224224 }
225225
226- char * normalized = (char * )Dmod_Malloc (normalized_len + 1 );
226+ char * normalized = (char * )Dmod_MallocEx (normalized_len + 1 , DMVFS_ALLOCATOR_NAME );
227227 if (normalized == NULL )
228228 {
229229 // Cleanup on error
@@ -281,7 +281,7 @@ static char* to_absolute_path(const char* path)
281281 {
282282 size_t cwd_len = (g_cwd != NULL ) ? strlen (g_cwd ) : 0 ;
283283 size_t path_len = strlen (path );
284- abs_path = (char * )Dmod_Malloc (cwd_len + 1 + path_len + 1 );
284+ abs_path = (char * )Dmod_MallocEx (cwd_len + 1 + path_len + 1 , DMVFS_ALLOCATOR_NAME );
285285 if (abs_path != NULL )
286286 {
287287 if (cwd_len > 0 )
@@ -678,7 +678,7 @@ static mount_point_t* add_mount_point(const char* mount_point, Dmod_Context_t* f
678678 }
679679 }
680680
681- free_entry -> mount_point = Dmod_Malloc (strlen (mount_point ) + 1 );
681+ free_entry -> mount_point = Dmod_MallocEx (strlen (mount_point ) + 1 , DMVFS_ALLOCATOR_NAME );
682682 if (free_entry -> mount_point == NULL )
683683 {
684684 DMOD_LOG_ERROR ("Failed to allocate memory for mount point\n" );
@@ -760,14 +760,14 @@ DMOD_INPUT_API_DECLARATION(dmvfs, 1.0, bool, _init, (int max_mount_points, int m
760760 return false;
761761 }
762762
763- g_mount_points = (mount_point_t * )Dmod_Malloc (sizeof (mount_point_t ) * max_mount_points );
763+ g_mount_points = (mount_point_t * )Dmod_MallocEx (sizeof (mount_point_t ) * max_mount_points , DMVFS_ALLOCATOR_NAME );
764764 if (g_mount_points == NULL )
765765 {
766766 DMOD_LOG_ERROR ("Failed to allocate memory for mount points\n" );
767767 return false;
768768 }
769769
770- g_open_files = (file_t * )Dmod_Malloc (sizeof (file_t ) * max_open_files );
770+ g_open_files = (file_t * )Dmod_MallocEx (sizeof (file_t ) * max_open_files , DMVFS_ALLOCATOR_NAME );
771771 if (g_open_files == NULL )
772772 {
773773 DMOD_LOG_ERROR ("Failed to allocate memory for open files\n" );
@@ -2389,7 +2389,7 @@ DMOD_INPUT_API_DECLARATION(dmvfs, 1.0, int, _opendir, (void** dp, const char* pa
23892389 }
23902390
23912391 // Create a directory handle wrapper
2392- dir_handle_t * dir_wrapper = (dir_handle_t * )Dmod_Malloc (sizeof (dir_handle_t ));
2392+ dir_handle_t * dir_wrapper = (dir_handle_t * )Dmod_MallocEx (sizeof (dir_handle_t ), DMVFS_ALLOCATOR_NAME );
23932393 if (!dir_wrapper ) {
23942394 DMOD_LOG_ERROR ("Failed to allocate directory handle wrapper\n" );
23952395 // Close the opened directory
0 commit comments