[PHP-DEV] beginner question.... From: Thies C. Arntzen (thies <email protected>)
Date: 10/09/98

hi,
i'm just implementing an native iptc-reader...
wors fine so far, but when i run it i get:

Freeing e9078 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e9050 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e9028 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e9000 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e8fd8 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e8fb0 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
Freeing e8f88 (6 bytes), allocated in ../php3/php3_hash.c on line
955<br>
....

the code looks like that:

could somebody of you "wizzards" please tell me my mistake????

regards,
tc

image.c:

static void php3_read_iptc(FILE *fp,pval *info)
     /* read IPTC-info */
{
    unsigned short length;
    unsigned char *buffer;
    unsigned char key[ 8 ];

    unsigned char recnum, dataset;

    int inx, len;

    length = php3_read2(fp);
    length -= 2; /* length includes itself */

    buffer = emalloc(length);

    if (fread(buffer,length,1,fp) != 1) {
        return;
    }

    pval_destructor(info _INLINE_TLS);
    if (array_init(info) == FAILURE) {
        return;
    }

    inx = 0;

    while (inx < length) {
        if (buffer[ inx++ ] != 0x1c) { /* it's not our magic...*/
            continue;
        }

        if ((inx + 4) >= length)
            break;

        dataset = buffer[ inx++ ];
        recnum = buffer[ inx++ ];
        len = (((unsigned short) buffer[ inx ])<<8) | (unsigned
short)buffer[ inx+1 ];
        inx += 2;

        sprintf(key,"%d#%03d",(int) dataset,(int) recnum);

        if ((inx + len) >= length)
            break;

        add_assoc_stringl(info,key,buffer+inx,len,1);

        inx += len;
    }

    efree(buffer);
}

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>