[maemo-commits] [maemo-commits] r17511 - in projects/haf/trunk/clutter: clutter/json debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Feb 25 13:19:25 EET 2009
Author: gw
Date: 2009-02-25 13:19:23 +0200 (Wed, 25 Feb 2009)
New Revision: 17511

Modified:
   projects/haf/trunk/clutter/clutter/json/json-parser.c
   projects/haf/trunk/clutter/debian/changelog
Log:
Fixed coverity findings for json-parser.c


Modified: projects/haf/trunk/clutter/clutter/json/json-parser.c
===================================================================
--- projects/haf/trunk/clutter/clutter/json/json-parser.c	2009-02-25 10:42:48 UTC (rev 17510)
+++ projects/haf/trunk/clutter/clutter/json/json-parser.c	2009-02-25 11:19:23 UTC (rev 17511)
@@ -1,5 +1,5 @@
 /* json-parser.c - JSON streams parser
- * 
+ *
  * This file is part of JSON-GLib
  * Copyright (C) 2007  OpenedHand Ltd.
  *
@@ -167,7 +167,7 @@
   /**
    * JsonParser::parse-start:
    * @parser: the #JsonParser that received the signal
-   * 
+   *
    * The ::parse-start signal is emitted when the parser began parsing
    * a JSON data stream.
    */
@@ -197,7 +197,7 @@
   /**
    * JsonParser::object-start:
    * @parser: the #JsonParser that received the signal
-   * 
+   *
    * The ::object-start signal is emitted each time the #JsonParser
    * starts parsing a #JsonObject.
    */
@@ -560,7 +560,7 @@
       if (token == G_TOKEN_LEFT_CURLY)
         {
           JsonNode *old_node = priv->current_node;
-      
+
           priv->current_node = json_node_new (JSON_NODE_OBJECT);
 
           token = json_parse_object (parser, scanner, TRUE);
@@ -571,7 +571,7 @@
           if (token != G_TOKEN_NONE)
             {
               g_free (name);
-              
+
               if (node)
                 json_node_free (node);
 
@@ -594,7 +594,7 @@
 
           continue;
         }
-     
+
       if (token == G_TOKEN_LEFT_BRACE)
         {
           JsonNode *old_node = priv->current_node;
@@ -616,7 +616,7 @@
 
           json_object_add_member (object, name, node);
           node->parent = priv->current_node;
-          
+
           g_signal_emit (parser, parser_signals[OBJECT_MEMBER], 0,
                          object,
                          name);
@@ -641,6 +641,8 @@
             }
           else
             {
+              g_free (name);
+              json_object_unref (object);
               return G_TOKEN_INT;
             }
         }
@@ -676,6 +678,8 @@
           break;
 
         default:
+          g_free (name);
+          json_object_unref (object);
           return G_TOKEN_SYMBOL;
         }
 
@@ -683,7 +687,7 @@
         {
           json_object_add_member (object, name, node);
           node->parent = priv->current_node;
-          
+
           g_signal_emit (parser, parser_signals[OBJECT_MEMBER], 0,
                          object,
                          name);
@@ -737,7 +741,7 @@
         if (next_token == G_TOKEN_INT || next_token == G_TOKEN_FLOAT)
           {
             priv->root = priv->current_node = json_node_new (JSON_NODE_VALUE);
-            
+
             token = g_scanner_get_next_token (scanner);
             switch (token)
               {
@@ -792,7 +796,7 @@
                    "Parse error on line %d: %s",
                    scanner->line,
                    message);
-      
+
       parser->priv->last_error = error;
       g_signal_emit (parser, parser_signals[ERROR], 0, error);
     }
@@ -814,7 +818,7 @@
 
 /**
  * json_parser_new:
- * 
+ *
  * Creates a new #JsonParser instance. You can use the #JsonParser to
  * load a JSON stream from either a file or a buffer and then walk the
  * hierarchy using the data types API.
@@ -865,7 +869,7 @@
       g_propagate_error (error, internal_error);
       retval = FALSE;
     }
-  
+
   g_free (data);
 
   return retval;
@@ -948,7 +952,7 @@
                         if (symbols[i].token == expected_token)
                           symbol_name = symbol_names + symbols[i].name_offset;
 
-                      if (msg)
+                      if (!msg)
                         msg = g_strconcat ("e.g. `", symbol_name, "'", NULL);
                     }
 

Modified: projects/haf/trunk/clutter/debian/changelog
===================================================================
--- projects/haf/trunk/clutter/debian/changelog	2009-02-25 10:42:48 UTC (rev 17510)
+++ projects/haf/trunk/clutter/debian/changelog	2009-02-25 11:19:23 UTC (rev 17511)
@@ -1,6 +1,7 @@
 clutter (0.8.2-0maemo19~unreleased) unstable; urgency=low
 
   * Fixed coverity findings for clutter-behaviour-rotate.c
+  * Fixed coverity findings for json-parser.c
   * unreleased
 
  -- Gordon Williams <gordon.williams at collabora.co.uk>  Mon, 23 Feb 2009 13:59:13 +0200


More information about the maemo-commits mailing list