25.07.2023 11:06, dinglimin wrote:
Replaced a call to malloc() and its respective call to free() with g_malloc() 
and g_free().
...
  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;

This is definitely wrong.

Hint: what this function will return if cpu_memory_rw_debug() fails?

/mjt

Reply via email to