diff --git a/cmp_tool.c b/cmp_tool.c index 5ae3061466b58e1cc614d832ebe7d5f1c6c83897..24587f6bbe0205ee4d259a302fc4e43e320e6f62 100755 --- a/cmp_tool.c +++ b/cmp_tool.c @@ -358,7 +358,7 @@ int main(int argc, char **argv) printf("Importing compressed data file %s ... ", data_file_name); buf_size = size = read_file_cmp_entity(data_file_name, - NULL, 0, 0); + NULL, 0, 0); if (size < 0) goto fail; /* to be save allocate at least the size of the cmp_entity struct */ @@ -384,7 +384,7 @@ int main(int argc, char **argv) print_cmp_info(&info); /* we reuse the entity buffer for the compressed data */ - cmp_data_adr = (uint32_t *)ent; + cmp_data_adr = (uint32_t *)decomp_input_buf; size = cmp_ent_get_cmp_data(ent, cmp_data_adr, buf_size); ent = NULL; if (size < 0) diff --git a/lib/cmp_tool_lib.c b/lib/cmp_tool_lib.c index 093bf651e42f7e322aeb084f50c8e97d11df3b9d..6028d00a5328ad79610f119be7d074a2a05faefc 100644 --- a/lib/cmp_tool_lib.c +++ b/lib/cmp_tool_lib.c @@ -96,11 +96,7 @@ static FILE *open_file(const char *dirname, const char *filename) } errno = 0; - pathname = (char *) malloc((size_t)n + 1); - if (!pathname) { - perror("malloc failed"); - abort(); - } + pathname = (char *) alloca((size_t)n + 1); errno = 0; n = snprintf(pathname, (size_t)n + 1, "%s%s", dirname, filename);