[ekiga] Do not use data after having been freed
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Do not use data after having been freed
- Date: Sat, 17 Jul 2010 09:39:40 +0000 (UTC)
commit 1f070979b168417aa7c951a4c81324e160bac2ca
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date: Sat Jul 17 11:37:55 2010 +0200
Do not use data after having been freed
This bug was introduced recently, commit 770d3872.
lib/engine/audioinput/audioinput-gmconf-bridge.cpp | 10 +++----
.../audiooutput/audiooutput-gmconf-bridge.cpp | 24 +++++++----------
lib/engine/components/opal/opal-gmconf-bridge.cpp | 27 +++++++++----------
lib/gmconf/gmconf-glib.c | 2 +-
lib/gui/gmconfwidgets.c | 18 ++++++------
5 files changed, 37 insertions(+), 44 deletions(-)
---
diff --git a/lib/engine/audioinput/audioinput-gmconf-bridge.cpp b/lib/engine/audioinput/audioinput-gmconf-bridge.cpp
index 4d04f8e..1659f11 100644
--- a/lib/engine/audioinput/audioinput-gmconf-bridge.cpp
+++ b/lib/engine/audioinput/audioinput-gmconf-bridge.cpp
@@ -64,23 +64,21 @@ void AudioInputCoreConfBridge::on_property_changed (std::string key, GmConfEntry
bool found = false;
gchar* value = gm_conf_entry_get_string (entry);
audioinput_core.get_devices (devices);
- if (value != NULL) {
+ if (value != NULL)
for (std::vector<AudioInputDevice>::iterator it = devices.begin ();
it < devices.end ();
- it++) {
+ it++)
if ((*it).GetString () == value) {
found = true;
break;
}
- }
- g_free (value);
- }
AudioInputDevice device;
if (found)
device.SetFromString (value);
- else
+ else
device.SetFromString (devices.begin ()->GetString ());
+ g_free (value);
if ( (device.type == "" ) ||
(device.source == "") ||
diff --git a/lib/engine/audiooutput/audiooutput-gmconf-bridge.cpp b/lib/engine/audiooutput/audiooutput-gmconf-bridge.cpp
index f773358..d66fd6a 100644
--- a/lib/engine/audiooutput/audiooutput-gmconf-bridge.cpp
+++ b/lib/engine/audiooutput/audiooutput-gmconf-bridge.cpp
@@ -81,24 +81,22 @@ void AudioOutputCoreConfBridge::on_property_changed (std::string key, GmConfEntr
bool found = false;
gchar* value = gm_conf_entry_get_string (entry);
audiooutput_core.get_devices (devices);
- if (value != NULL) {
+ if (value != NULL)
for (std::vector<AudioOutputDevice>::iterator it = devices.begin ();
it < devices.end ();
- it++) {
+ it++)
if ((*it).GetString () == value) {
found = true;
break;
}
- }
- g_free (value);
- }
AudioOutputDevice device;
if (found)
device.SetFromString (value);
- else
+ else
device.SetFromString (devices.begin ()->GetString ());
-
+ g_free (value);
+
if ( (device.type == "" ) ||
(device.source == "") ||
(device.name == "" ) ) {
@@ -116,20 +114,18 @@ void AudioOutputCoreConfBridge::on_property_changed (std::string key, GmConfEntr
PTRACE(4, "AudioOutputCoreConfBridge\tUpdating device");
AudioOutputDevice device;
- gchar* audio_device = NULL;
- audio_device = gm_conf_entry_get_string (entry);
+ gchar* audio_device = gm_conf_entry_get_string (entry);
- if (audio_device == NULL) {
+ if (audio_device == NULL)
PTRACE(1, "AudioOutputCoreConfBridge\t" << AUDIO_DEVICES_KEY "output_device" << " is NULL");
- }
else {
device.SetFromString(audio_device);
g_free (audio_device);
}
- if ( (device.type == "" ) ||
- (device.source == "") ||
- (device.name == "" ) ) {
+ if ( (device.type == "") ||
+ (device.source == "") ||
+ (device.name == "") ) {
PTRACE(1, "AudioOutputCore\tTried to set malformed device");
device.type = AUDIO_OUTPUT_FALLBACK_DEVICE_TYPE;
device.source = AUDIO_OUTPUT_FALLBACK_DEVICE_SOURCE;
diff --git a/lib/engine/components/opal/opal-gmconf-bridge.cpp b/lib/engine/components/opal/opal-gmconf-bridge.cpp
index f98a2e3..aaa4115 100644
--- a/lib/engine/components/opal/opal-gmconf-bridge.cpp
+++ b/lib/engine/components/opal/opal-gmconf-bridge.cpp
@@ -273,7 +273,7 @@ void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
gchar* str = gm_conf_entry_get_string (entry);
if (str != NULL)
sip_manager->set_outbound_proxy (str);
- g_free (str);
+ g_free (str);
}
else if (key == SIP_KEY "dtmf_mode") {
@@ -282,9 +282,9 @@ void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
else if (key == SIP_KEY "forward_host") {
gchar* str = gm_conf_entry_get_string (entry);
- if (str != NULL)
- sip_manager->set_forward_uri (str);
- g_free (str);
+ if (str != NULL)
+ sip_manager->set_forward_uri (str);
+ g_free (str);
}
else if (key == SIP_KEY "binding_timeout") {
@@ -321,14 +321,14 @@ void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
else if (key == H323_KEY "forward_host") {
gchar* str = gm_conf_entry_get_string (entry);
- if (str != NULL)
- h323_manager->set_forward_uri (str);
- g_free (str);
+ if (str != NULL)
+ h323_manager->set_forward_uri (str);
+ g_free (str);
}
}
}
#endif
-
+
//
// Personal Data Key
@@ -383,13 +383,13 @@ void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
couple = g_strsplit (ports, ":", 2);
g_free (ports);
- if (couple && couple [0])
+ if (couple && couple [0])
min_port = atoi (couple [0]);
-
- if (couple && couple [1])
+
+ if (couple && couple [1])
max_port = atoi (couple [1]);
-
- if (key == PORTS_KEY "udp_port_range")
+
+ if (key == PORTS_KEY "udp_port_range")
manager.set_udp_ports (min_port, max_port);
else
manager.set_tcp_ports (min_port, max_port);
@@ -397,4 +397,3 @@ void ConfBridge::on_property_changed (std::string key, GmConfEntry *entry)
g_strfreev (couple);
}
}
-
diff --git a/lib/gmconf/gmconf-glib.c b/lib/gmconf/gmconf-glib.c
index 453a533..249a71a 100644
--- a/lib/gmconf/gmconf-glib.c
+++ b/lib/gmconf/gmconf-glib.c
@@ -897,7 +897,7 @@ database_save_entry (G_GNUC_UNUSED GQuark quark,
GmConfEntry *entry = NULL;
GIOChannel *io = NULL;
gchar *value = NULL;
- const gchar *txt = NULL;
+ gchar *txt = NULL;
g_return_if_fail (data != NULL);
g_return_if_fail (user_data != NULL);
diff --git a/lib/gui/gmconfwidgets.c b/lib/gui/gmconfwidgets.c
index fbac013..7082631 100644
--- a/lib/gui/gmconfwidgets.c
+++ b/lib/gui/gmconfwidgets.c
@@ -350,7 +350,7 @@ string_option_menu_changed (GtkWidget *option_menu,
* should be of type string.
*/
void
-string_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid,
+string_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid,
GmConfEntry *entry,
gpointer data)
{
@@ -359,16 +359,16 @@ string_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid,
GtkTreeModel *model = NULL;
GtkTreeIter iter;
-
+
GtkWidget *e = NULL;
-
+
gchar *text = NULL;
gchar* txt = NULL;
-
+
if (gm_conf_entry_get_type (entry) == GM_CONF_STRING) {
-
+
e = GTK_WIDGET (data);
-
+
model = gtk_combo_box_get_model (GTK_COMBO_BOX (e));
count = gtk_tree_model_iter_n_children (model, NULL);
gtk_tree_model_get_iter_first (model, &iter);
@@ -378,14 +378,14 @@ string_option_menu_changed_nt (G_GNUC_UNUSED gpointer cid,
gtk_tree_model_get (model, &iter, 0, &text, -1);
txt = gm_conf_entry_get_string (entry);
if (text && !strcmp (text, txt)) {
-
+
g_free (text);
- g_free (txt);
+ g_free (txt);
break;
}
g_free (txt);
gtk_tree_model_iter_next (model, &iter);
-
+
g_free (text);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]