From 09cff061fce29ae8ede5965a37c183bdf9afcfa8 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Thu, 29 Oct 2009 12:37:32 -0400 Subject: [PATCH] [#1933] Protecting pointer --- sflphone-client-gnome/src/callable_obj.c | 2 +- sflphone-client-gnome/src/conference_obj.c | 4 +++- sflphone-common/src/iax/iaxvoiplink.cpp | 24 ++++++++++++++-------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sflphone-client-gnome/src/callable_obj.c b/sflphone-client-gnome/src/callable_obj.c index 15dc04fd01..adab9d2ba9 100644 --- a/sflphone-client-gnome/src/callable_obj.c +++ b/sflphone-client-gnome/src/callable_obj.c @@ -58,7 +58,7 @@ gchar* call_get_peer_name (const gchar *format) if (!end) { return g_strndup (format, 0); } else { - name = g_strdup (format); + name = format; return g_strndup(name, end - name); } } diff --git a/sflphone-client-gnome/src/conference_obj.c b/sflphone-client-gnome/src/conference_obj.c index c0ab255d62..039f01f73e 100644 --- a/sflphone-client-gnome/src/conference_obj.c +++ b/sflphone-client-gnome/src/conference_obj.c @@ -38,6 +38,7 @@ void create_new_conference (conference_state_t state, const gchar* confID, confe { conference_obj_t *obj; + gchar* conf_id; // Allocate memory obj = g_new0 (conference_obj_t, 1); @@ -46,7 +47,8 @@ void create_new_conference (conference_state_t state, const gchar* confID, confe obj->_state = state; // Set the ID field - obj->_confID = g_strdup (confID); + conf_id = confID; + obj->_confID = g_strdup (conf_id); *new_conf = obj; } diff --git a/sflphone-common/src/iax/iaxvoiplink.cpp b/sflphone-common/src/iax/iaxvoiplink.cpp index 32a46a2477..1aac07fae3 100644 --- a/sflphone-common/src/iax/iaxvoiplink.cpp +++ b/sflphone-common/src/iax/iaxvoiplink.cpp @@ -882,22 +882,28 @@ IAXVoIPLink::iaxHandleVoiceEvent (iax_event* event, IAXCall* call) int expandedSize, nbSample_; AudioCodec *ac; - ac = call->getCodecMap().getCodec (call -> getAudioCodec()); + if (!call) + return; - audiolayer->getMainBuffer()->setInternalSamplingRate(ac->getClockRate()); - - // If we receive datalen == 0, some things of the jitter buffer in libiax2/iax.c - // were triggered - - if (!event->datalen) { + if (!event->datalen) { // Skip this empty packet. //_debug("IAX: Skipping empty jitter-buffer interpolated packet\n"); return; } - if (audiolayer) { + ac = call->getCodecMap ().getCodec (call->getAudioCodec ()); - int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate(); + if (!ac) + return; + + if (audiolayer) { + + audiolayer->getMainBuffer ()->setInternalSamplingRate (ac->getClockRate ()); + + // If we receive datalen == 0, some things of the jitter buffer in libiax2/iax.c + // were triggered + + int _mainBufferSampleRate = audiolayer->getMainBuffer()->getInternalSamplingRate(); // On-the-fly codec changing (normally, when we receive a full packet) // as per http://tools.ietf.org/id/draft-guy-iax-03.txt -- GitLab