gam-resource-manager: fixed a memory handling error.
authorJaska Uimonen <jaska.uimonen@helsinki.fi>
Wed, 27 Aug 2014 13:52:44 +0000 (16:52 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 8 Jan 2015 16:37:16 +0000 (18:37 +0200)
Change-Id: I2b377fbc2785ea4772d4536c2ee8849502a6dff9

src/plugins/gam-resource-manager/plugin-gam-resource-manager.c

index a14e2c3..4f43947 100644 (file)
@@ -404,7 +404,7 @@ static const char *get_default_sink(gam_connect_t *ctx, mrp_resource_set_t *rset
         routing_target_t *t = mrp_list_entry(p, typeof(*t), hook);
 
         if (is_sink_available(ctx, t->name)) {
-            name = t->name;
+            name = mrp_strdup(t->name);
             break;
         }
     }
@@ -484,7 +484,7 @@ static bool register_sink_with_gam(gam_connect_t *ctx, mrp_resource_set_t *rset,
 
     if (!sink) {
         mrp_log_error("gam_connect: error finding default sink, using global default");
-        sink = ctx->default_sink;
+        sink = mrp_strdup(ctx->default_sink);
     }
 
     rset_id = mrp_get_resource_set_id(rset);
@@ -494,6 +494,8 @@ static bool register_sink_with_gam(gam_connect_t *ctx, mrp_resource_set_t *rset,
     mrp_debug("gam_connect: register rset %u with GAM! (%s(%u) -> %s(%u))",
             rset_id, source, source_id, sink, sink_id);
 
+    mrp_free(sink);
+
     /*
         calling GAM:
             domain: "audio-manager", function: "connect", source_id, sink_id