qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.
@ 2023-07-25  8:06 dinglimin
  2023-07-25  8:13 ` Michael Tokarev
  2023-07-25  9:00 ` dinglimin
  0 siblings, 2 replies; 23+ messages in thread
From: dinglimin @ 2023-07-25  8:06 UTC (permalink / raw)
  To: richard.henderson; +Cc: qemu-devel, dinglimin

Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free().

Signed-off-by: dinglimin <dinglimin@cmss.chinamobile.com>
---
 semihosting/uaccess.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c
index 8018828069..8f2e6f63ee 100644
--- a/semihosting/uaccess.c
+++ b/semihosting/uaccess.c
@@ -14,11 +14,10 @@
 void *softmmu_lock_user(CPUArchState *env, target_ulong addr,
                         target_ulong len, bool copy)
 {
-    void *p = malloc(len);
+    void *p = g_malloc(len);
     if (p && copy) {
         if (cpu_memory_rw_debug(env_cpu(env), addr, p, len, 0)) {
-            free(p);
-            p = NULL;
+            g_free(p);
         }
     }
     return p;
-- 
2.30.0.windows.2





^ permalink raw reply related	[flat|nested] 23+ messages in thread
* [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc
@ 2024-02-26  9:06 dinglimin
  2024-02-26  9:48 ` Philippe Mathieu-Daudé
  2024-02-26 10:02 ` Zhao Liu
  0 siblings, 2 replies; 23+ messages in thread
From: dinglimin @ 2024-02-26  9:06 UTC (permalink / raw)
  To: richard.henderson, philmd; +Cc: qemu-devel, dinglimin

Signed-off-by: dinglimin <dinglimin@cmss.chinamobile.com>
---
 semihosting/uaccess.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c
index dc587d73bc..7788ead9b2 100644
--- a/semihosting/uaccess.c
+++ b/semihosting/uaccess.c
@@ -14,10 +14,10 @@
 void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
                         target_ulong len, bool copy)
 {
-    void *p = malloc(len);
+    void *p = g_try_malloc(len);
     if (p && copy) {
         if (cpu_memory_rw_debug(env_cpu(env), addr, p, len, 0)) {
-            free(p);
+            g_free(p);
             p = NULL;
         }
     }
@@ -87,5 +87,5 @@ void uaccess_unlock_user(CPUArchState *env, void *p,
     if (len) {
         cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1);
     }
-    free(p);
+    g_free(p);
 }
-- 
2.30.0.windows.2





^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-02-26 10:18 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25  8:06 [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc dinglimin
2023-07-25  8:13 ` Michael Tokarev
2023-07-25  9:00 ` dinglimin
2023-07-25  9:13   ` Michael Tokarev
2023-07-25  9:35     ` Peter Maydell
2023-07-26  4:37       ` 回复: " dinglimin
2023-07-26  9:43         ` Peter Maydell
2023-07-26 15:21           ` Richard Henderson
2023-07-27 14:56             ` Peter Maydell
2023-07-27 15:04               ` Daniel P. Berrangé
2023-07-27 16:31                 ` Richard Henderson
2023-07-28  5:12                   ` dinglimin
2023-07-28  9:35                     ` Peter Maydell
2023-07-28 10:50                       ` dinglimin
2023-07-28 11:27                         ` Peter Maydell
2023-07-28 12:16               ` Peter Maydell
2023-07-26  7:07       ` dinglimin
2023-07-25 10:57   ` dinglimin
  -- strict thread matches above, loose matches on Subject: below --
2024-02-26  9:06 dinglimin
2024-02-26  9:48 ` Philippe Mathieu-Daudé
2024-02-26 10:03   ` Daniel P. Berrangé
2024-02-26 10:16   ` Peter Maydell
2024-02-26 10:02 ` Zhao Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).