[jscore] Release property names in signature detection
authorKalle Vahlman <kalle.vahlman@movial.com>
Thu, 23 Apr 2009 11:05:16 +0000 (14:05 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Thu, 23 Apr 2009 11:05:16 +0000 (14:05 +0300)
jscorebus/jscorebus-signature.c

index 73f5a23858841c30d5fe1f5c8be3ef3b41ee0363..3572ca040740700fda71c4f6df5327df7570513e 100644 (file)
@@ -118,17 +118,18 @@ char *jsvalue_to_signature(JSContextRef context,
         /* Check for arrays */
         if (jsvalue_instanceof(context, jsvalue, "Array"))
         {
-          JSPropertyNameArrayRef propnames;
           char *array_signature;
 
           propnames = JSObjectCopyPropertyNames(context, (JSObjectRef)jsvalue);
           if (!jsarray_get_signature(context, jsvalue, propnames, &array_signature))
           { 
             g_warning("Could not create array signature");
+            JSPropertyNameArrayRelease(propnames);
             break;
           }
           signature = g_strdup_printf("a%s", array_signature);
           g_free(array_signature);
+          JSPropertyNameArrayRelease(propnames);
           break;
         }
 
@@ -154,10 +155,10 @@ char *jsvalue_to_signature(JSContextRef context,
         /* Check structs */
         if (jsvalue_typeof(context, jsvalue, "DBusStruct"))
         {
-          JSPropertyNameArrayRef propnames;
           JSObjectRef value = (JSObjectRef)JSObjectGetPrivate((JSObjectRef)jsvalue);
           propnames = JSObjectCopyPropertyNames(context, value);
           jsstruct_get_signature(context, value, propnames, &signature);
+          JSPropertyNameArrayRelease(propnames);
           break;
         }
 
@@ -169,7 +170,7 @@ char *jsvalue_to_signature(JSContextRef context,
           signature = g_strdup_printf("a%s", dict_signature);
           g_free(dict_signature);
         }
-
+        JSPropertyNameArrayRelease(propnames);
         break;
       }
     case kJSTypeUndefined: