Fix the invalid client pid of content filename
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 17 Dec 2013 09:02:00 +0000 (18:02 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 17 Dec 2013 09:02:00 +0000 (18:02 +0900)
Change-Id: I2d31a4560ffbf8cec14177dc2cc523d051e8e834

src/instance.c

index 53dd9e4..265d931 100644 (file)
@@ -795,7 +795,15 @@ HAPI struct inst_info *instance_create(struct client_node *client, double timest
                return NULL;
        }
 
+       if (client) {
+               inst->client = client_ref(client);
+               if (client_event_callback_add(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst) < 0) {
+                       ErrPrint("Failed to add client event callback: %s\n", inst->id);
+               }
+       }
+
        if (fork_package(inst, pkgname) < 0) {
+               (void)client_unref(inst->client);
                DbgFree(inst->title);
                DbgFree(inst->category);
                DbgFree(inst->cluster);
@@ -804,13 +812,6 @@ HAPI struct inst_info *instance_create(struct client_node *client, double timest
                return NULL;
        }
 
-       if (client) {
-               inst->client = client_ref(client);
-               if (client_event_callback_add(inst->client, CLIENT_EVENT_DEACTIVATE, client_deactivated_cb, inst) < 0) {
-                       ErrPrint("Failed to add client event callback: %s\n", inst->id);
-               }
-       }
-
        inst->state = INST_INIT;
        inst->requested_state = INST_INIT;
        instance_ref(inst);