resource-asm: move tmp file unlinking to a proper place.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Mon, 15 Apr 2013 08:48:47 +0000 (11:48 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 8 Jan 2015 16:37:09 +0000 (18:37 +0200)
src/plugins/plugin-resource-asm.c

index d921309..c1dbbde 100644 (file)
@@ -1268,10 +1268,6 @@ static asm_to_lib_t *process_msg(lib_to_asm_t *msg, asm_data_t *ctx)
                     update_client_mapping_file(client);
 #endif
                     if (client->n_sets <= 0) {
-#ifdef FILE_WRITING_HACK
-                        /* temporary hack*/
-                        unlink(get_filename(client));
-#endif
                         mrp_htbl_remove(ctx->clients, u_to_p(pid), TRUE);
                         client = NULL;
                     }
@@ -1641,7 +1637,10 @@ static void htbl_free_client(void *key, void *object)
     client_t *client = (client_t *) object;
 
     mrp_htbl_destroy(client->sets, TRUE);
-
+#ifdef FILE_WRITING_HACK
+    /* temporary hack*/
+    unlink(get_filename(client));
+#endif
     /* TODO: free memory when resource API allows that */
     mrp_free(client);
 }
@@ -1819,6 +1818,11 @@ error:
         ctx->pid = 0;
     }
 
+    if (ctx->clients) {
+        mrp_htbl_destroy(ctx->clients, TRUE);
+        ctx->clients = NULL;
+    }
+
     if (ctx->sighandler) {
         mrp_del_sighandler(ctx->sighandler);
         ctx->sighandler = NULL;