get_operation_char(operation, name, sizeof(name)),
bdev->data->devnode);
+ thread_id = bdev->thread_id;
+ if (thread_id < 0 || thread_id >= THREAD_MAX) {
+ _E("Fail to find thread to add");
+ return -EPERM;
+ }
+
op = (struct operation_queue *)malloc(sizeof(struct operation_queue));
if (!op) {
_E("malloc failed");
msg = dbus_message_ref(msg);
op->msg = msg;
- thread_id = bdev->thread_id;
- if (thread_id < 0 || thread_id >= THREAD_MAX) {
- _E("Fail to find thread to add");
- return -EPERM;
- }
-
/* LOCK
* during adding queue and checking the queue length */
pthread_mutex_lock(&(th_manager[thread_id].mutex));
thread_id = find_thread(bdev->data->devnode);
if (thread_id < 0 || thread_id >= THREAD_MAX) {
_E("Fail to find thread to add");
+ free_block_data(data);
+ free(bdev);
return -EPERM;
}
bdev->thread_id = thread_id;
return -ENOMEM;
}
- dinfo->file_hash = g_hash_table_new_full(
+ dinfo->file_hash = g_hash_table_new_full(
g_str_hash, g_str_equal, NULL, NULL);
if (!dinfo->file_hash) {
_E("Malloc failed");
dinfo->name = (char *)malloc(len);
if (!dinfo->name) {
_E("Malloc failed");
+ g_hash_table_unref(dinfo->file_hash);
free(dinfo);
return -ENOMEM;
}