[seed] free binary strings always, this is a bit risky, as it assumes that when we see an array of c uints



commit 2a90188b7465e3d22c89cf4d882b699daa7f15d2
Author: Alan Knowles <alan roojs com>
Date:   Sun May 13 22:30:43 2012 +0800

    free binary strings always, this is a bit risky, as it assumes that when we see an array of c uints and its used as a binary string, we should always free it... - Im not sure if it should really check transfer settings.. - but this will crash badly if it is not right...

 libseed/seed-types.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 69bf70a..f4eaaaa 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -961,7 +961,11 @@ seed_value_from_gi_argument_full (JSContextRef ctx,
 	    // we are assuming that this is the array_len from the call..
 	    g_base_info_unref ((GIBaseInfo *) array_type_info);
 	    
-	    return seed_value_from_binary_string (ctx, arg->v_pointer, array_len, exception);
+	    ret = seed_value_from_binary_string (ctx, arg->v_pointer, array_len, exception);
+	    // always free arg...
+	    g_free(arg->v_pointer);
+	
+	    return ret;
  
 	  }
         
@@ -2362,7 +2366,7 @@ seed_value_from_binary_string (JSContextRef ctx,
   jsstr = JSStringCreateWithCharacters((const JSChar*)jchar, n_bytes);
   valstr = JSValueMakeString (ctx, jsstr);
   JSStringRelease (jsstr);
-
+  
   return valstr;
   
 }



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