if (!w)
return;
+ /* We reach this point in dirty state when ptable_free() is called from the
+ * atexit cleanup callback, and that the global table still holds a live
+ * wizard. This happens before all the SV bodies are freed, so all the wizard
+ * callbacks are still alive (as they are referenced by the undead wizard).
+ * Hence it is safe to decrement their refcount. Later on, the wizard free
+ * callback itself will trigger when the wizard body is reaped, but it will
+ * be skipped as it guards against dirty state - which is good since nothing
+ * has to be done anymore at that point. */
+
SvREFCNT_dec(w->cb_data);
SvREFCNT_dec(w->cb_get);
SvREFCNT_dec(w->cb_set);