[reSIProcate] Printing parameters in ExtensionHeader

Jason Fischl jason at counterpath.com
Sat Jan 21 13:06:53 CST 2006


> --------------------------------------------------
> char* msg2str(SipMessage* msg){
>
>         resip::Data& DatatoSend = msg->getEncoded();
>         DatatoSend.clear();
>         resip::DataStream encodeStream(DatatoSend);
>         msg->encode(encodeStream);
>         encodeStream.flush();   // pronto per partire
>
>         return (char*)DatatoSend.c_str();
> }

You are returning a pointer to stack memory that is going out of scope
when the function returns. I think what you want is the following
instead.

SipMessage msg;
cerr << Data::from(msg).c_str();

Jason



More information about the resiprocate-devel mailing list