From: Michael Schroeder Date: Mon, 31 Aug 2015 10:50:27 +0000 (+0200) Subject: bindings: fix bugs in appdata refcounting X-Git-Tag: 0.6.12~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6efa10642461d222b44af04466dd2630474a6ee;p=thirdparty%2Flibsolv.git bindings: fix bugs in appdata refcounting For perl, values put on the stack must be moralized. For tcl, Tcl_SetObjResult already does the increment of the result. --- diff --git a/bindings/solv.i b/bindings/solv.i index 06d47033..49d8f9c0 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -483,7 +483,7 @@ typedef SV *AppObjectPtr; $1 = (void *)0; } %typemap(out) AppObjectPtr { - $result = $1 ? SvREFCNT_inc($1) : newSV(0); + $result = sv_2mortal($1 ? SvREFCNT_inc($1) : newSV(0)); argvi++; } #elif defined(SWIGRUBY) @@ -502,8 +502,6 @@ typedef Tcl_Obj *AppObjectPtr; $1 = (void *)$input; } %typemap(out) AppObjectPtr { - if ($1) - Tcl_IncrRefCount((Tcl_Obj *)$1); Tcl_SetObjResult(interp, $1 ? $1 : Tcl_NewObj()); } #else