]> git.eshelyaron.com Git - emacs.git/commitdiff
* Fix memory leak when native compiled function is collected
authorAndrea Corallo <akrl@sdf.org>
Thu, 11 Jun 2020 21:24:00 +0000 (23:24 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 11 Jun 2020 16:37:40 +0000 (18:37 +0200)
* src/alloc.c (cleanup_vector): Handle native compiled
functions.

src/alloc.c

index 9a9dbb52e7b333a4a2d974e78686a94ed41e5050..750ffbd2dd8251146d4716e437ab7dc96cdda645 100644 (file)
@@ -3156,6 +3156,17 @@ cleanup_vector (struct Lisp_Vector *vector)
        PSEUDOVEC_STRUCT (vector, Lisp_Native_Comp_Unit);
       dispose_comp_unit (cu, true);
     }
+  else if (NATIVE_COMP_FLAG
+          && PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SUBR))
+    {
+      struct Lisp_Subr *subr =
+       PSEUDOVEC_STRUCT (vector, Lisp_Subr);
+      if (subr->native_comp_u[0])
+       {
+         xfree (subr->symbol_name);
+         xfree (subr->native_c_name[0]);
+       }
+    }
 }
 
 /* Reclaim space used by unmarked vectors.  */