aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
diff options
context:
space:
mode:
Diffstat (limited to 'src/rtos')
-rw-r--r--src/rtos/chibios.c6
-rw-r--r--src/rtos/linux.c12
-rw-r--r--src/rtos/rtos.c11
3 files changed, 10 insertions, 19 deletions
diff --git a/src/rtos/chibios.c b/src/rtos/chibios.c
index 4d2b1b2..a56d3ce 100644
--- a/src/rtos/chibios.c
+++ b/src/rtos/chibios.c
@@ -150,10 +150,8 @@ static int chibios_update_memory_signature(struct rtos *rtos)
param = (struct chibios_params *) rtos->rtos_specific_params;
/* Free existing memory description.*/
- if (param->signature) {
- free(param->signature);
- param->signature = 0;
- }
+ free(param->signature);
+ param->signature = NULL;
signature = malloc(sizeof(*signature));
if (!signature) {
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index cd1ed21..dbbf97b 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -627,8 +627,7 @@ struct threads *liste_del_task(struct threads *task_list, struct threads **t,
task_list = (*t)->next;
/* free content of threads */
- if ((*t)->context)
- free((*t)->context);
+ free((*t)->context);
free(*t);
*t = prev ? prev : task_list;
@@ -781,8 +780,7 @@ static int clean_threadlist(struct target *target)
while (temp != NULL) {
old = temp;
- if (temp->context)
- free(temp->context);
+ free(temp->context);
temp = temp->next;
free(old);
@@ -931,10 +929,8 @@ static int linux_task_update(struct target *target, int context)
while (thread_list != NULL) {
thread_list->status = 0; /*setting all tasks to dead state*/
- if (thread_list->context) {
- free(thread_list->context);
- thread_list->context = NULL;
- }
+ free(thread_list->context);
+ thread_list->context = NULL;
thread_list = thread_list->next;
}
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 97ce255..62b65aa 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -100,9 +100,7 @@ static void os_free(struct target *target)
if (!target->rtos)
return;
- if (target->rtos->symbols)
- free(target->rtos->symbols);
-
+ free(target->rtos->symbols);
free(target->rtos);
target->rtos = NULL;
}
@@ -646,10 +644,9 @@ int rtos_try_next(struct target *target)
return 0;
os->type = *type;
- if (os->symbols) {
- free(os->symbols);
- os->symbols = NULL;
- }
+
+ free(os->symbols);
+ os->symbols = NULL;
return 1;
}