diff --git a/libc3/call.c b/libc3/call.c
index 4994ab6..9478e8a 100644
--- a/libc3/call.c
+++ b/libc3/call.c
@@ -16,6 +16,7 @@
#include "buf_inspect.h"
#include "buf_parse.h"
#include "call.h"
+#include "cfn.h"
#include "ident.h"
#include "list.h"
@@ -23,6 +24,8 @@ void call_clean (s_call *call)
{
assert(call);
list_delete_all(call->arguments);
+ if (call->cfn)
+ cfn_delete(call->cfn);
}
s_call * call_copy (const s_call *src, s_call *dest)
diff --git a/libc3/cfn.c b/libc3/cfn.c
index 6bea741..28c2bc7 100644
--- a/libc3/cfn.c
+++ b/libc3/cfn.c
@@ -126,6 +126,13 @@ s_cfn * cfn_copy (const s_cfn *cfn, s_cfn *dest)
return dest;
}
+void cfn_delete (s_cfn *cfn)
+{
+ assert(cfn);
+ cfn_clean(cfn);
+ free(cfn);
+}
+
s_cfn * cfn_init (s_cfn *cfn, const s_sym *name, s_list *arg_types,
const s_sym *result_type)
{
diff --git a/libc3/cfn.h b/libc3/cfn.h
index 285c49d..6905b6b 100644
--- a/libc3/cfn.h
+++ b/libc3/cfn.h
@@ -20,7 +20,8 @@ s_cfn * cfn_init (s_cfn *cfn, const s_sym *name, s_list *arg_types,
const s_sym *result_type);
void cfn_clean (s_cfn *cfn);
-/* constructor */
+/* constructor, destructor */
+void cfn_delete (s_cfn *cfn);
s_cfn * cfn_new_copy (const s_cfn *src);
/* observers */