From 3acf732c2f23d8508f692efb2b222169914bfcdc Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 22 Apr 2011 21:34:08 +0100 Subject: [PATCH] perl: Decrement refcount in $g->delete_event_callback. This updates commit bc468c87d04b34faacd208c49cca4a5096e5103c. --- generator/generator_perl.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/generator/generator_perl.ml b/generator/generator_perl.ml index c832469..e2ec254 100644 --- a/generator/generator_perl.ml +++ b/generator/generator_perl.ml @@ -256,11 +256,15 @@ delete_event_callback (g, event_handle) int event_handle; PREINIT: char key[64]; + SV *cb; CODE: snprintf (key, sizeof key, \"_perl_event_%%d\", event_handle); - guestfs_set_private (g, key, NULL); - - guestfs_delete_event_callback (g, event_handle); + cb = guestfs_get_private (g, key); + if (cb) { + SvREFCNT_dec (cb); + guestfs_set_private (g, key, NULL); + guestfs_delete_event_callback (g, event_handle); + } SV * last_errno (g) -- 1.8.3.1