[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[osip-dev] Howto free resources correctly

From: Roger Schreiter
Subject: [osip-dev] Howto free resources correctly
Date: Thu, 25 Sep 2014 21:56:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5


I'm just doing first steps with libosip2.

libosip2 seems to prefer malloc and free instead of using
constant mem space provided by the application.

Can someone please check my below assumptions and tell, whether
I understand right:

- When using osip_message_set_xyz, all data, which are passed by
  pointer, have to be in allocated memory (osip_malloc, osip_strdup,
  ...), never in heap or global variable or part of other allocated

- osip_message_free tries to osip_free every data, which was set by

- I saw in sample code:
  osip_message_set_max_forwards(*msg, "70");
  osip_message_set_user_agent(*msg, "my_application 1.0");
  This might leed to problems?

- When a message is transformed to an event with
  I need not care anymore to free the msg, because it will be
  freed automatically, when the event is freed later.

- When an event was fed to a transaction with:
  I need not care anymore to free the event.
  It will be freed, by the transaction, after the application did
  consume the event.
  Or maybe, when the transaction is killed.
  Anyway: As soon, as the event is part of the transaction, I do not
  need explicitely free the event anymore.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]