Re: [reSIProcate] Problem with memory corruption
Thanks - that did work so I checked it in.
The more I look at the Security.cxx code, there looks there are still a fair
number of bugs with it.
On 11/26/04 7:21 PM, "nagendra modadugu" <nagendra@xxxxxxxxxxxxxxx> wrote:
>
> This fix works for me:
>
> --- Security.cxx (revision 3639)
> +++ Security.cxx (working copy)
> @@ -425,7 +425,7 @@
> size_t len = BIO_get_mem_data(out,&p);
> assert(p);
> assert(len);
> - Data buf(Data::Take, p, len);
> + Data buf(Data::Borrow, p, len);
>
> this->onWritePEM(key, type, buf);
> }
>
> My guess is that Data::Take results in a change of ownership
> of a buffer that is _also_ owned by the memory BIO.
>
> So this buffer gets deleted twice: first when the Data object
> goes out of scope, and second when the BIO structure is freed.
> I don't know what distinction, if any, exists between Data::Share
> and Data::Borrow.
>
> nagendra
>
> ps: I don't have commit access, so if this fix makes sense and
> works for you please commit.
>
> * Cullen Jennings <fluffy@xxxxxxxxx> [2004-11-26 16:37:20 -0800]:
>
>>
>> I'm having some problems that I think are partially caused by a buffer
>> getting freed twice and mostly cause by me not understanding how Data works.
>>
>> What is the Take, Share, Borrow stuff mean in Data?
>>
>> If I have a buffer and I want the Data to make a copy of the buffer in the
>> constructor then never touch the buffer again including not freeing it, What
>> do I do?
>>
>> Thanks, Cullen
>>
>>
>> _______________________________________________
>> resiprocate-devel mailing list
>> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
>> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel