Commit 4d566e5d5d41d6e760bd70a296651926d46eec3e

Sylvain 2021-11-22T16:39:22

VITA, PSP: use SDL_malloc

diff --git a/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c
index 3b7988b..fd83260 100644
--- a/src/thread/psp/SDL_syssem.c
+++ b/src/thread/psp/SDL_syssem.c
@@ -43,13 +43,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
     SDL_sem *sem;
 
-    sem = (SDL_sem *) malloc(sizeof(*sem));
+    sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
     if (sem != NULL) {
         /* TODO: Figure out the limit on the maximum value. */
         sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
         if (sem->semid < 0) {
             SDL_SetError("Couldn't create semaphore");
-            free(sem);
+            SDL_free(sem);
             sem = NULL;
         }
     } else {
@@ -68,7 +68,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
             sem->semid = 0;
         }
 
-        free(sem);
+        SDL_free(sem);
     }
 }
 
diff --git a/src/thread/vita/SDL_syssem.c b/src/thread/vita/SDL_syssem.c
index e419465..4965623 100644
--- a/src/thread/vita/SDL_syssem.c
+++ b/src/thread/vita/SDL_syssem.c
@@ -44,13 +44,13 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value)
 {
     SDL_sem *sem;
 
-    sem = (SDL_sem *) malloc(sizeof(*sem));
+    sem = (SDL_sem *) SDL_malloc(sizeof(*sem));
     if (sem != NULL) {
         /* TODO: Figure out the limit on the maximum value. */
         sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL);
         if (sem->semid < 0) {
             SDL_SetError("Couldn't create semaphore");
-            free(sem);
+            SDL_free(sem);
             sem = NULL;
         }
     } else {
@@ -69,7 +69,7 @@ void SDL_DestroySemaphore(SDL_sem *sem)
             sem->semid = 0;
         }
 
-        free(sem);
+        SDL_free(sem);
     }
 }