]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
cleanup callbacks that might have been registered by Python script
authorR. Christian McDonald <me@rcm.sh>
Thu, 19 Jan 2023 21:30:47 +0000 (16:30 -0500)
committerGitHub <noreply@github.com>
Thu, 19 Jan 2023 21:30:47 +0000 (16:30 -0500)
pythonmod/pythonmod.c

index 19b464633d4d6ae40ffa12203974d4ed20547a78..aa8609c58b63299005277ec12014f129154efd8a 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
  *                     Marek Vavrusa  (xvavru00 AT stud.fit.vutbr.cz)
+ * Copyright (c) 2022, Rubicon Communications, LLC (Netgate)
  *
  * This software is open source.
  *
@@ -567,6 +568,10 @@ void pythonmod_deinit(struct module_env* env, int id)
 
    /* Module is deallocated in Python */
    env->modinfo[id] = NULL;
+
+   /* iterate over all possible callback types and clean up each in turn */
+   for (int cbtype = 0; cbtype < inplace_cb_types_total; cbtype++)
+      inplace_cb_delete(env, cbtype, id);
 }
 
 void pythonmod_inform_super(struct module_qstate* qstate, int id, struct module_qstate* super)