On 9/1/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On >>Behalf Of ext Stefano Sabatini >>Sent: Monday, September 01, 2008 3:44 PM >>To: sofia-sip-devel@lists.sourceforge.net >>Subject: Re: [Sofia-sip-devel] How to free a sdp_session_t struct >> >>>>> Free the home used for allocating the session. >>>> >>>> Hi, and thanks for the reply. >>>> Yes that's a solution, nonetheless it looks still weird to >>me, to have >>>> to use an home just for that seems >>>> overkill. >>> >>> There is also this problem. Assuming that I have to pass around the >>> allocated home, I can't use a stack allocated home, so I >>> have to use su_home_new() (here choosing an arbitrary size value...). >>> >>> Then I think there is no way to know the home used by an >>sdp_session_t >>> object, so I would have to pass around the home >>> object to which the sdp_session_t is bound, which is pretty awkward, >>> *either* to have a memleak. >> >>Another solution could be to pass around sdp_parser_t rather than >>sdp_session_t, then >>use sdp_session() to get the sdp_session_t from the parser and free >>both parser and >>session with sdp_parser_free(), do you think this is an >>acceptable solution? >> >>But still this looks like a strange solution and not particularly >>convenient (why to pass around the whole parser if what I need is just >>the session?), and is the reason for which I was looking for an >>sdp_session_free() function. > > I guess you don't really want to keep the parser state. > A home is a pool for allocated memory in the Sofia stack, so yes, you need > to pass it around to wherever you free the sdp_session_t.
Thanks for the reply Mikhail. So if I understood it correctly I need to keep an home just for every sdp_session_t. So my next obvious question is: it would be possible to change the API and implement an sdp_session_free() function? The sdp_session_t could inherit the home of the sdp_parser which creates it, or if created from scratch (sdp_session_create(home)?) it would require an home as argument. Not sure if this is possible to do without to break backward compatibility. And still I have the sensation I'm doing something very strange with my code, if no one ever had felt the necessity for a such facility (I'm using the sdp_session_t to store an SDP in a C-language-friendly manner)... Kind regards. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sofia-sip-devel mailing list Sofia-sip-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel