summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kpi/dlt-kpi-options.c23
-rw-r--r--src/kpi/dlt-kpi-process.c3
-rw-r--r--src/shared/dlt_common.c1
3 files changed, 13 insertions, 14 deletions
diff --git a/src/kpi/dlt-kpi-options.c b/src/kpi/dlt-kpi-options.c
index ea15961..0f6938c 100644
--- a/src/kpi/dlt-kpi-options.c
+++ b/src/kpi/dlt-kpi-options.c
@@ -117,7 +117,10 @@ void dlt_kpi_init_configuration(DltKpiConfig *config)
DltReturnValue dlt_kpi_read_configuration_file(DltKpiConfig *config, char *file_name)
{
FILE *file;
- char *line, *token, *value, *pch, *strchk;
+ char *line = NULL;
+ char *token = NULL;
+ char *value = NULL;
+ char *pch, *strchk;
int tmp;
if(config == NULL || file_name == NULL)
@@ -136,20 +139,16 @@ DltReturnValue dlt_kpi_read_configuration_file(DltKpiConfig *config, char *file_
return DLT_RETURN_ERROR;
}
- if((line = malloc(COMMAND_LINE_SIZE)) == 0)
- {
- fprintf(stderr, "%s: Out of memory!\n", __func__);
- return DLT_RETURN_ERROR;
- }
+ if(((line = malloc(COMMAND_LINE_SIZE)) == 0) ||
+ ((token = malloc(COMMAND_LINE_SIZE)) == 0) ||
+ ((value = malloc(COMMAND_LINE_SIZE)) == 0))
- if((token = malloc(COMMAND_LINE_SIZE)) == 0)
{
- fprintf(stderr, "%s: Out of memory!\n", __func__);
- return DLT_RETURN_ERROR;
- }
+ fclose(file);
+ free(line);
+ free(token);
+ free(value);
- if((value = malloc(COMMAND_LINE_SIZE)) == 0)
- {
fprintf(stderr, "%s: Out of memory!\n", __func__);
return DLT_RETURN_ERROR;
}
diff --git a/src/kpi/dlt-kpi-process.c b/src/kpi/dlt-kpi-process.c
index ad157e1..22a46e6 100644
--- a/src/kpi/dlt-kpi-process.c
+++ b/src/kpi/dlt-kpi-process.c
@@ -256,7 +256,8 @@ DltKpiProcess *dlt_kpi_clone_process(DltKpiProcess *original)
if(new_process->command_line == NULL)
{
fprintf(stderr, "%s: Out of Memory\n", __func__);
- return NULL;
+ free(new_process);
+ return NULL;
}
strncpy(new_process->command_line, original->command_line, strlen(original->command_line) + 1);
}
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 8808801..b98c7fa 100644
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -477,7 +477,6 @@ DltReturnValue dlt_filter_load(DltFilter *filter, const char *filename, int verb
{
snprintf(str,DLT_COMMON_BUFFER_LENGTH, "Maximum number (%d) of allowed filters reached, ignoring rest of filters!\n", DLT_FILTER_MAX);
dlt_log(LOG_WARNING, str);
- return DLT_RETURN_OK;
}
}