[272] in Hesiod

home help back first fref pref prev next nref lref last post

Re: to free or not to free

daemon@ATHENA.MIT.EDU (Dean Anderson)
Tue May 23 14:13:48 1995

To: "Todd C. Miller" <Todd.Miller@cs.colorado.edu>
Cc: hesiod@MIT.EDU
In-Reply-To: Your message of "Tue, 23 May 1995 10:58:54 EDT."
             <199505231658.KAA18137@clytemnestra.cs.colorado.edu> 
Date: Tue, 23 May 1995 14:10:28 -0400
From: Dean Anderson <dean@hi.com>

I have fixes to dynamically allocate this buffer.

		--Dean

In message <199505231658.KAA18137@clytemnestra.cs.colorado.edu> you write:
>In message <199505230107.TAA16400@clytemnestra.cs.colorado.edu>
>	so spake "Todd C. Miller" (Todd.Miller):
>
>> In looking at other code that uses hesiod it seems that people
>> are freeing the buffer returned by hes_resolve().  Now, in the
>> source on athena-dist the buffer is static and should not be free(3)'d.
>> Are there other hesiod implementations that do use a dynamically
>> allocated buffer?  If so, is there any real way of telling which
>> implementation you are dealing with?
>
>Well, I finally realized why people are free(3)'ing the buffer
>hes_resolve() returns (myself included).  The programmer's guide
>explicately tells you to do so.  Not only is this completely false
>it is dangerous since the guide then goes on to state that
>successive calls to hes_resolve() won't clobber the previous data.
>Wrong!  A look at res_scan() reveals that it is a static buffer
>that *does* get overwritten on successive calls.  I have verified
>that the ultrix hes_resolv() does the same thing.  Below are diffs
>that correct doc/programmer.txt.
>
> - todd
>

home help back first fref pref prev next nref lref last post