[glib] Plug mem leaks in parse_value_from_blob



commit 5b2c7f10bd5a42d2956b53b13f3aabb947f901dd
Author: Christian Persch <chpe gnome org>
Date:   Fri May 14 14:15:42 2010 +0200

    Plug mem leaks in parse_value_from_blob
    
    The result of read_string() was leaked.
    
    Bug #618615.

 gio/gdbusmessage.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 4d98e3e..e733bba 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -902,6 +902,7 @@ parse_value_from_blob (GMemoryInputStream    *mis,
           if (v == NULL)
             goto fail;
           ret = g_variant_new_string (v);
+          g_free (v);
         }
     }
   else if (g_variant_type_equal (type, G_VARIANT_TYPE_OBJECT_PATH))
@@ -925,9 +926,11 @@ parse_value_from_blob (GMemoryInputStream    *mis,
                            G_IO_ERROR_INVALID_ARGUMENT,
                            _("Parsed value `%s' is not a valid D-Bus object path"),
                            v);
+              g_free (v);
               goto fail;
             }
           ret = g_variant_new_object_path (v);
+          g_free (v);
         }
     }
   else if (g_variant_type_equal (type, G_VARIANT_TYPE_SIGNATURE))
@@ -949,9 +952,11 @@ parse_value_from_blob (GMemoryInputStream    *mis,
                            G_IO_ERROR_INVALID_ARGUMENT,
                            _("Parsed value `%s' is not a valid D-Bus signature"),
                        v);
+              g_free (v);
               goto fail;
             }
           ret = g_variant_new_signature (v);
+          g_free (v);
         }
     }
   else if (g_variant_type_is_array (type))
@@ -1110,9 +1115,11 @@ parse_value_from_blob (GMemoryInputStream    *mis,
                            G_IO_ERROR_INVALID_ARGUMENT,
                            _("Parsed value `%s' for variant is not a valid D-Bus signature"),
                            sig);
+              g_free (sig);
               goto fail;
             }
           variant_type = g_variant_type_new (sig);
+          g_free (sig);
           value = parse_value_from_blob (mis,
                                          dis,
                                          variant_type,



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