Skip to content
Snippets Groups Projects
Commit 281a9a28 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Prevent memory leak

parent b561e14f
No related branches found
No related tags found
1 merge request!7Fix a bug in the definition in imagette header
...@@ -384,7 +384,7 @@ int main(int argc, char **argv) ...@@ -384,7 +384,7 @@ int main(int argc, char **argv)
print_cmp_info(&info); print_cmp_info(&info);
/* we reuse the entity buffer for the compressed data */ /* 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); size = cmp_ent_get_cmp_data(ent, cmp_data_adr, buf_size);
ent = NULL; ent = NULL;
if (size < 0) if (size < 0)
......
...@@ -96,11 +96,7 @@ static FILE *open_file(const char *dirname, const char *filename) ...@@ -96,11 +96,7 @@ static FILE *open_file(const char *dirname, const char *filename)
} }
errno = 0; errno = 0;
pathname = (char *) malloc((size_t)n + 1); pathname = (char *) alloca((size_t)n + 1);
if (!pathname) {
perror("malloc failed");
abort();
}
errno = 0; errno = 0;
n = snprintf(pathname, (size_t)n + 1, "%s%s", dirname, filename); n = snprintf(pathname, (size_t)n + 1, "%s%s", dirname, filename);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment