[gjs: 42/45] gi: make sure to release correct arguments



commit a3458699998b93c950f1743dc28aeaf47308c753
Author: Tommi Komulainen <tko litl com>
Date:   Tue Mar 2 12:16:58 2010 +0000

    gi: make sure to release correct arguments
    
    All arguments are IN arguments as they're in in_arg_cvalue and
    in_arg_pointers arrays so always increase the index to the arrays to
    ensure the correct argument gets released.
    
    Avoids trying to free stack allocated out value.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=611585

 gi/function.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gi/function.c b/gi/function.c
index a25a21c..e52db0e 100644
--- a/gi/function.c
+++ b/gi/function.c
@@ -729,7 +729,6 @@ release:
             if (direction == GI_DIRECTION_IN) {
                 arg = &in_arg_cvalues[in_args_pos];
                 transfer = g_arg_info_get_ownership_transfer(&arg_info);
-                ++in_args_pos;
             } else {
                 arg = &inout_original_arg_cvalues[inout_args_pos];
                 ++inout_args_pos;
@@ -747,6 +746,8 @@ release:
             }
         }
 
+        ++in_args_pos;
+
         /* Don't free out arguments if function threw an exception or we failed
          * earlier - note "postinvoke_release_failed" is separate from "failed".  We
          * sync them up after this loop.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]