Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 1995 12:38:49 -0400 (EDT)
From:      John Capo <jc@irbs.com>
To:        freebsd-bugs@freebsd.org
Subject:   ypserv cores with phk malloc
Message-ID:  <199509221638.MAA01237@irbs.irbs.com>

next in thread | raw e-mail | index | archive | help
A few months ago I linked the entire system with gnumalloc.  The
only show stopper I found was ypserv.  Its a show stopper again.

I asked these questions at that time on the -current list and had
no response.

Ypserv frees the results of db lookups.  I can't find anything that
says this is the proper action.  Is it?

Looking at the code in db, pointers are returned whithin dbm objects
and freeing them looks bogus to me.

The old malloc silently refused to free the memory due to internal
audit checks.  Gnumalloc and phkmalloc core.

Patches below comment out all of the know bogus and suspect bogus
free calls.  Somebody that is familiar with the db routines needs
to look at this.

John Capo
IRBS Engineering

*** server.c.orig	Fri Sep 22 11:51:31 1995
--- server.c	Fri Sep 22 12:33:33 1995
***************
*** 349,355 ****
--- 349,357 ----
  	    }
  	    if ((dbp->seq)(dbp,&ckey,&dummyval,R_NEXT))
  		ckey.data = NULL;
+ 		/*
  		free(dummyval.data);
+ 		*/
  	}
  	else
  	    ckey = *ikey;
***************
*** 365,372 ****
--- 367,376 ----
  	if ((dbp->get)(dbp,&ckey,dval,0))
  	{
  	    /* Free key, unless it comes from the caller! */
+ 	    /*
  	    if (ikey == NULL || ckey.data != ikey->data)
  		free(ckey.data);
+ 	    */
  
  	    if (ikey && ikey->data != NULL)
  	    {
***************
*** 383,404 ****
--- 387,417 ----
  	{
  	    if (okey)
  		*okey = ckey;
+ 	    /*
  	    else if (ikey == NULL || ikey->data != ckey.data)
  		free(ckey.data);
+ 	    */
  
  	    return YP_TRUE;
  	}
  
  	/* Free old value */
+ 	/*
  	free(dval->data);
+ 	*/
  
  	if ((dbp->seq)(dbp,&nkey,&dummyval,R_NEXT))
  		nkey.data = NULL;
+ 
+ 	/*
  	free(dummyval.data);
+ 	*/
  
  	/* Free old key, unless it comes from the caller! */
+ 	/*
  	if (ikey == NULL || ckey.data != ikey->data)
  	    free(ckey.data);
+ 	    */
  
  	if (ckey.data == NULL || nkey.data == NULL)
  	    return YP_NOMORE;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509221638.MAA01237>