This patch is just adding a single header, but because it also modifies
all the C files to add the #include, it was made as a patch on its own to
ease review.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Duplicating things makes maintenance error-prone, which is not a good idea.
In case the abort procedure would need an update, it would be easy then
to forget some place, leading to leaks, if not worse.
Beside, goto is not as bad as academics would like people to believe, when
it is used correctly (and this case is one of them).
The name for the label was given an explicit meaning to make code easy to
understand.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch removes the code not used. Because the if block
check that buffer[0] is NULL, then, we don't need check it
again inside.
Image is not used yet, so is NULL. We can return NULL.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch returns NULL, because the variable image is not used yet.
The patch also removes three lines:
- buffer[0] = NULL; /* Initialize pointer to avoid spurious free in cleanup code */
RErrorCode = RERR_BADIMAGEFILE;
jpeg_destroy_decompress(&cinfo);
fclose(file);
- if (buffer[0])
- free(buffer[0]);
buffer is a local variable. The malloc is not used yet. So:
- We set the value to NULL, then check if is null to call free(). So the free()
call is never used. We can remove the last too lines.
- We don't need set now to NULL, because the variable is empty (the
initializated (or not) value is not used, and is destroyed as local variable
when we returns, just one line later.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This patch removes the goto call. I copied the code after the bye: label and
I paste it in the goto-calls.
Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
As pointed by Coverity, there's a free on the content of this buffer at
function's end, but if the image's width or height is lower than 1 then we
could reach this free before allocating anything, thus having an
uninitialised pointer.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This patch makes all files appear together when listing files and
it is more clear about their function.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>