Add missing calls to `free` for variable `filebuffer`.
Add missing calls to `fclose` for variables `fd` and `fd_out`.
Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
char* filebuffer = malloc ( buf.st_size+10 );
FILE* fd = fopen ( input,"r" );
fread ( filebuffer, 1, buf.st_size,fd );
char* filebuffer = malloc ( buf.st_size+10 );
FILE* fd = fopen ( input,"r" );
fread ( filebuffer, 1, buf.st_size,fd );
if (!output)
{
output = malloc(strlen(input+5));
if (!output)
{
output = malloc(strlen(input+5));
if (!fd_out)
{
fprintf(stderr, "Failed to open output file: %s\n", output);
if (!fd_out)
{
fprintf(stderr, "Failed to open output file: %s\n", output);
exit(1);
}
fwrite ( head,1,sizeof ( ldr_header_t ),fd_out );
fwrite ( filebuffer,1,buf.st_size,fd_out );
printf("Firmware image %s is ready\n", output);
exit(1);
}
fwrite ( head,1,sizeof ( ldr_header_t ),fd_out );
fwrite ( filebuffer,1,buf.st_size,fd_out );
printf("Firmware image %s is ready\n", output);
+ free(filebuffer);
+ fclose(fd_out);