Ticket #271: tgalib.C.diff

File tgalib.C.diff, 442 bytes (added by Joses, 17 years ago)

alloc fixes to api/tgalib.C for version 5.10

  • tgalib.C

    old new  
    3333               
    3434        // Allocate the structure that will hold our eventual image data (must free it!)
    3535        pImageData = (tImageTGA*)malloc(sizeof(tImageTGA));
     36        if ( !pImageData )
     37        {
     38                fclose(pFile);
     39                return NULL;
     40        }
    3641
    3742        // Read in the length in bytes from the header to the pixel data
    3843        fread(&length, sizeof(byte), 1, pFile);