From: Richard W.M. Jones Date: Fri, 22 Apr 2011 20:34:08 +0000 (+0100) Subject: perl: Decrement refcount in $g->delete_event_callback. X-Git-Tag: 1.11.3~3 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3acf732c2f23d8508f692efb2b222169914bfcdc;p=libguestfs.git perl: Decrement refcount in $g->delete_event_callback. This updates commit bc468c87d04b34faacd208c49cca4a5096e5103c. --- 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)