Changeset 57 for trunk/JPGPROC/source/gbmsrc/gbmtifh.c
- Timestamp:
- May 11, 2023, 10:44:53 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JPGPROC/source/gbmsrc/gbmtifh.c
r2 r57 310 310 gbm_file_lseek(fd, offset_ifd, SEEK_SET); 311 311 while ( n_ifds_to_skip-- > 0 ) 312 if ( !skip_ifd(fd, motorola) ) 312 if ( !skip_ifd(fd, motorola) ) { 313 ifh_free(ifh); 313 314 return TE_N_IFD; 315 } 314 316 315 317 if ( (ecode = read_ifd(fd, motorola, &(ifh->ifd))) != TE_OK ) … … 443 445 if ( (byte_ptr = (byte *) malloc((size_t) (n * sizeof(byte)))) == NULL ) 444 446 return FALSE; 445 if ( (tag = get_tag_slot(type, ifd)) == NULL ) 446 return FALSE; 447 if ( (tag = get_tag_slot(type, ifd)) == NULL ) { 448 free(byte_ptr); 449 return FALSE; 450 } 447 451 tag->type = type; 448 452 tag->data_type = D_BYTE; … … 452 456 value, 453 457 n * sizeof(byte)); 458 free(byte_ptr); 454 459 return TRUE; 455 460 } … … 465 470 if ( (ascii_ptr = (char *) malloc((size_t) n)) == NULL ) 466 471 return FALSE; 467 if ( (tag = get_tag_slot(type, ifd)) == NULL ) 468 return FALSE; 472 if ( (tag = get_tag_slot(type, ifd)) == NULL ) { 473 free(ascii_ptr); 474 return FALSE; 475 } 469 476 tag->type = type; 470 477 tag->data_type = D_ASCII; 471 478 tag->length = (long) n; 472 479 strcpy(tag->value = ascii_ptr, value); 480 free(ascii_ptr); 473 481 return TRUE; 474 482 } … … 482 490 if ( (short_ptr = (short *) malloc((size_t) (n * sizeof(short)))) == NULL ) 483 491 return FALSE; 484 if ( (tag = get_tag_slot(type, ifd)) == NULL ) 485 return FALSE; 492 if ( (tag = get_tag_slot(type, ifd)) == NULL ) { 493 free(short_ptr); 494 return FALSE; 495 } 486 496 tag->type = type; 487 497 tag->data_type = D_SHORT; … … 491 501 value, 492 502 n * sizeof(short)); 503 free(short_ptr); 493 504 return TRUE; 494 505 } … … 502 513 if ( (long_ptr = (long *) malloc((size_t) (n * sizeof(long)))) == NULL ) 503 514 return FALSE; 504 if ( (tag = get_tag_slot(type, ifd)) == NULL ) 505 return FALSE; 515 if ( (tag = get_tag_slot(type, ifd)) == NULL ) { 516 free(long_ptr); 517 return FALSE; 518 } 506 519 tag->type = type; 507 520 tag->data_type = D_LONG; … … 511 524 value, 512 525 n * sizeof(long)); 526 free(long_ptr); 513 527 return TRUE; 514 528 } … … 522 536 if ( (rational_ptr = (rational *) malloc((size_t) (n * sizeof(rational)))) == NULL ) 523 537 return FALSE; 524 if ( (tag = get_tag_slot(type, ifd)) == NULL ) 525 return FALSE; 538 if ( (tag = get_tag_slot(type, ifd)) == NULL ) { 539 free(rational_ptr); 540 return FALSE; 541 } 526 542 tag->type = type; 527 543 tag->data_type = D_RATIONAL; … … 531 547 value, 532 548 n * sizeof(rational)); 549 free(rational_ptr); 533 550 return TRUE; 534 551 }
Note:
See TracChangeset
for help on using the changeset viewer.