]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
bindings: fix bugs in appdata refcounting
authorMichael Schroeder <mls@suse.de>
Mon, 31 Aug 2015 10:50:27 +0000 (12:50 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 31 Aug 2015 10:50:27 +0000 (12:50 +0200)
For perl, values put on the stack must be moralized. For tcl,
Tcl_SetObjResult already does the increment of the result.

bindings/solv.i

index 06d4703350a214786e382578d6bacf1314077126..49d8f9c0ef491bd7482650a8d4e3a11d74e64a3b 100644 (file)
@@ -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