Fix bad call to fclose with NULL pointer
This commit is contained in:
parent
be42e72d22
commit
f40a2ff2ad
|
@ -1842,7 +1842,7 @@ int imagetopnm(opj_image_t * image, const char *outfile, int force_split)
|
||||||
if(two)
|
if(two)
|
||||||
{
|
{
|
||||||
v = *red + adjustR; ++red;
|
v = *red + adjustR; ++red;
|
||||||
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
/* netpbm: */
|
/* netpbm: */
|
||||||
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
||||||
|
@ -1850,13 +1850,13 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
if(triple)
|
if(triple)
|
||||||
{
|
{
|
||||||
v = *green + adjustG; ++green;
|
v = *green + adjustG; ++green;
|
||||||
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
/* netpbm: */
|
/* netpbm: */
|
||||||
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
||||||
|
|
||||||
v = *blue + adjustB; ++blue;
|
v = *blue + adjustB; ++blue;
|
||||||
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
/* netpbm: */
|
/* netpbm: */
|
||||||
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
||||||
|
@ -1913,7 +1913,6 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
destname = (char*)malloc(strlen(outfile) + 8);
|
destname = (char*)malloc(strlen(outfile) + 8);
|
||||||
if(destname == NULL){
|
if(destname == NULL){
|
||||||
fprintf(stderr, "imagetopnm: memory out\n");
|
fprintf(stderr, "imagetopnm: memory out\n");
|
||||||
fclose(fdest);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (compno = 0; compno < ncomp; compno++)
|
for (compno = 0; compno < ncomp; compno++)
|
||||||
|
@ -1953,7 +1952,7 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
for (i = 0; i < wr * hr; i++)
|
for (i = 0; i < wr * hr; i++)
|
||||||
{
|
{
|
||||||
v = *red + adjustR; ++red;
|
v = *red + adjustR; ++red;
|
||||||
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
/* netpbm: */
|
/* netpbm: */
|
||||||
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
||||||
|
@ -1961,7 +1960,7 @@ if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
if(has_alpha)
|
if(has_alpha)
|
||||||
{
|
{
|
||||||
v = *alpha++;
|
v = *alpha++;
|
||||||
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
if(v > 65535) v = 65535; else if(v < 0) v = 0;
|
||||||
|
|
||||||
/* netpbm: */
|
/* netpbm: */
|
||||||
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
fprintf(fdest, "%c%c",(unsigned char)(v>>8), (unsigned char)v);
|
||||||
|
|
Loading…
Reference in New Issue