From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <14fb670993da32ae68ae138589b26e1b@rei2.9hal> References: <14fb670993da32ae68ae138589b26e1b@rei2.9hal> Date: Sun, 26 Aug 2012 09:36:12 -0400 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=047d7b60399ce40e1404c82b4aa5 Subject: Re: [9fans] dns Topicbox-Message-UUID: afa090da-ead7-11e9-9d60-3106f5b1d025 --047d7b60399ce40e1404c82b4aa5 Content-Type: text/plain; charset=UTF-8 It does. In fact, it's the Tsrv case that looks wrong (it leaks space already allocated by rralloc). nrp = rralloc(rp->type); ... case Tsoa: soa = nrp->soa; --- save space allocated by rralloc *nrp = *rp; --- destroy pointer by copying onto it nrp->soa = soa; --- restore pointer *nrp->soa = *rp->soa; ---- copy substructure. ... On 26 August 2012 09:16, wrote: > when you look at rralloc(), you can see that these sub structures are > indeed malloced so rrcopy needs to copy these too (like it does for the > Tsrv case). > --047d7b60399ce40e1404c82b4aa5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable It does. In fact, it's the Tsrv case that looks wrong (it leaks space a= lready allocated by rralloc).

nrp =3D rralloc(rp->type);
...
case Tsoa:
soa =3D nrp->soa; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0--- save space allocated by rralloc
*nrp= =3D *rp; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 --- destroy pointer by copying onto it
nrp->soa =3D soa;= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 --- restore pointer
*nrp= ->soa =3D *rp->soa; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0---- copy subst= ructure.
...


On 26 August 2012 09:16, <cinap_lenrek@gmx.de> wrote= :
when you look at rralloc(),= you can see that these sub structures are
indeed malloced so rrcopy needs to copy these too (like it does for the
Tsrv case).

--047d7b60399ce40e1404c82b4aa5--