Re: [PHP-DEV] Error in php3_hash / memory manager? From: Rasmus Lerdorf (rasmus <email protected>)
Date: 06/26/98

> [Fri Jun 26 13:16:40 1998] [error] Possible PHP3 memory leak detected
> (harmless): 1428392 bytes from :1508864

Whoa.. Looks like some pretty screwed up pointers here!

> #0 shutdown_memory_manager () at alloc.c:362
> 362 snprintf(memory_leak_buf,512,"Possible
> PHP3 memory leak detected (harmless): %d bytes from
> %s:%d",t->size,t->filename,t->lineno);

So, t->size is invalid, t->filename looks like it is blank and t->lineno
is messed up as well.

Looks like the php3_Ora_Bind() is messing with memory somewhere. I am
looking at it, but I don't see anything obvious. It is emalloc'ing a
bunch of stuff and it does't look like it is very careful about free'ing
things. Of course, that shouldn't cause a core dump. Maybe something in
the way you are manipulating the cursor->params hash table.

Or perhaps this bit of code:

    if((paramname = estrndup(argv[1]->value.str.val,
argv[1]->value.str.len)) == NULL){
        php3_error(E_WARNING, "Out of memory for parametername");
        efree(newparam);
        RETURN_FALSE;
    }

    if (_php3_hash_add(cursor->params, paramname, argv[1]->value.str.len +
1, newparam, sizeof(oraParam), (void **)&paramptr) == FAI
LURE) {
        /* XXX _php3_hash_destroy */
        efree(paramname);
        efree(newparam);
        php3_error(E_ERROR, "Could not make parameter placeholder");
        RETURN_FALSE;
    }

You are passing a length of value.str.len+1 into the hash_add function,
but you have only allocated value.str.len. I don't think this is the
problem either though because of the way hash_add works.

Keep hunting...

-Rasmus