Re: [PHP-DEV] add_assoc_stringl WAS:beginner question.... From: Zeev Suraski (bourbon <email protected>)
Date: 10/10/98

What script gives you these warnings?

Zeev

At 18:47 09/10/98 +0200, Thies C. Arntzen wrote:
>hi again (sorry for wasting bandwidth)
>
>if i run configure without the --enable-debug switch i don't get the error
>message...
>
>but anyhow, if i use add_assoc_stringl who take care of freeing up the
>key-buffer???
>
>regards,
>tc
>
>
>"Thies C. Arntzen" wrote:
>
>> hi,
>> i'm just implementing an native iptc-reader...
>> works 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>
>
>
>--
>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>
>
>
>

--
Zeev Suraski   <zeev <email protected>>
For a PGP public key, finger bourbon <email protected>

-- 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>