summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-06-11 23:24:00 +0200
committerAndrea Corallo <akrl@sdf.org>2020-06-11 18:37:40 +0200
commitab78ed83b977084885265a1842e4e474e0938d9f (patch)
tree908300baac704c93498303a80a95b5e103b11e7b /src
parent904550d8c8e1583d0444bcb28b5d1130af6bafc3 (diff)
* Fix memory leak when native compiled function is collected
* src/alloc.c (cleanup_vector): Handle native compiled functions.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 9a9dbb52e7b..750ffbd2dd8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -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. */