Skip to content
Snippets Groups Projects
Commit b5fa385f authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #6623: fix more leaks, fixed some warnings

parent 988b173b
No related branches found
No related tags found
No related merge requests found
...@@ -470,7 +470,6 @@ gchar* serialize_history_call_entry (callable_obj_t *entry) ...@@ -470,7 +470,6 @@ gchar* serialize_history_call_entry (callable_obj_t *entry)
account_id = (entry->_accountID == NULL || g_strcasecmp (entry->_accountID,"") == 0) ? "empty": entry->_accountID; account_id = (entry->_accountID == NULL || g_strcasecmp (entry->_accountID,"") == 0) ? "empty": entry->_accountID;
confID = (entry->_historyConfID == NULL) ? "" : entry->_historyConfID; confID = (entry->_historyConfID == NULL) ? "" : entry->_historyConfID;
DEBUG("==================================== SERIALIZE: CONFID %s", confID);
record_file = (entry->_recordfile == NULL) ? "" : entry->_recordfile; record_file = (entry->_recordfile == NULL) ? "" : entry->_recordfile;
......
...@@ -956,7 +956,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) ...@@ -956,7 +956,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
default: default:
WARN ("Update calltree add - Should not happen!"); WARN ("Update calltree add - Should not happen!");
} }
if (g_strcasecmp (srtp_enabled, "true") == 0) if (srtp_enabled && g_strcasecmp (srtp_enabled, "true") == 0)
pixbuf_security = gdk_pixbuf_new_from_file (ICONS_DIR "/secure_off.svg", NULL); pixbuf_security = gdk_pixbuf_new_from_file (ICONS_DIR "/secure_off.svg", NULL);
} else if (tab == contacts) { } else if (tab == contacts) {
...@@ -1010,7 +1010,7 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent) ...@@ -1010,7 +1010,7 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent)
gchar *date = NULL; gchar *date = NULL;
gchar *duration = NULL; gchar *duration = NULL;
const gchar * description = calltree_display_call_info (c, DISPLAY_TYPE_HISTORY, NULL); gchar * description = calltree_display_call_info (c, DISPLAY_TYPE_HISTORY, NULL);
gtk_tree_store_prepend (history->store, &iter, parent); gtk_tree_store_prepend (history->store, &iter, parent);
...@@ -1040,8 +1040,10 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent) ...@@ -1040,8 +1040,10 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent)
date = get_formatted_start_timestamp (c->_time_start); date = get_formatted_start_timestamp (c->_time_start);
duration = get_call_duration (c); duration = get_call_duration (c);
duration = g_strconcat (date , duration , NULL); gchar * full_duration = g_strconcat (date , duration , NULL);
description = g_strconcat (description , duration, NULL); g_free (duration);
description = g_strconcat (description , full_duration, NULL);
g_free (full_duration);
//Resize it //Resize it
if (pixbuf) if (pixbuf)
...@@ -1059,6 +1061,8 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent) ...@@ -1059,6 +1061,8 @@ void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent)
3, c, // Pointer 3, c, // Pointer
-1); -1);
g_free (description);
if (pixbuf != NULL) if (pixbuf != NULL)
g_object_unref (G_OBJECT (pixbuf)); g_object_unref (G_OBJECT (pixbuf));
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
void void
sflphone_throw_exception (int err) sflphone_throw_exception (int err)
{ {
gchar* markup=""; gchar* markup = NULL;
switch (err) { switch (err) {
case ALSA_PLAYBACK_DEVICE: case ALSA_PLAYBACK_DEVICE:
...@@ -48,6 +48,7 @@ sflphone_throw_exception (int err) ...@@ -48,6 +48,7 @@ sflphone_throw_exception (int err)
break; break;
} }
if (markup)
main_window_error_message (markup); main_window_error_message (markup);
free (markup); g_free (markup);
} }
...@@ -56,7 +56,6 @@ main (int argc, char *argv[]) ...@@ -56,7 +56,6 @@ main (int argc, char *argv[])
if (g_strcmp0 (argv[i], "--debug") == 0) if (g_strcmp0 (argv[i], "--debug") == 0)
set_log_level (LOG_DEBUG); set_log_level (LOG_DEBUG);
// GtkWidget *window;
g_thread_init (NULL); g_thread_init (NULL);
gdk_threads_init (); gdk_threads_init ();
gdk_threads_enter (); gdk_threads_enter ();
...@@ -91,10 +90,8 @@ main (int argc, char *argv[]) ...@@ -91,10 +90,8 @@ main (int argc, char *argv[])
NULL) ; NULL) ;
if (!sflphone_init (&error)) { if (!sflphone_init (&error)) {
gchar *markup;
ERROR (error->message); ERROR (error->message);
markup = g_markup_printf_escaped ( gchar *markup = g_markup_printf_escaped (
_ ("Unable to initialize.\nMake sure the daemon is running.\nError: %s"), _ ("Unable to initialize.\nMake sure the daemon is running.\nError: %s"),
error->message); error->message);
......
...@@ -320,11 +320,10 @@ create_main_window () ...@@ -320,11 +320,10 @@ create_main_window ()
int response = gtk_dialog_run (GTK_DIALOG (dialog)); int response = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (dialog);
if (response == GTK_RESPONSE_YES) { if (response == GTK_RESPONSE_YES)
show_preferences_dialog(); show_preferences_dialog();
}
#endif #endif
} }
...@@ -346,10 +345,10 @@ get_main_window () ...@@ -346,10 +345,10 @@ get_main_window ()
} }
void void
main_window_message (GtkMessageType type, gchar * markup) main_window_message (GtkMessageType type, const gchar * const markup)
{ {
GtkWidget * dialog = gtk_message_dialog_new_with_markup ( GtkWidget * dialog = gtk_message_dialog_new(
GTK_WINDOW (get_main_window()), GTK_DIALOG_MODAL GTK_WINDOW (get_main_window()), GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_CLOSE, NULL); | GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_CLOSE, NULL);
...@@ -357,23 +356,23 @@ main_window_message (GtkMessageType type, gchar * markup) ...@@ -357,23 +356,23 @@ main_window_message (GtkMessageType type, gchar * markup)
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), markup); gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), markup);
gtk_dialog_run (GTK_DIALOG (dialog)); gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (dialog);
} }
void void
main_window_error_message (gchar * markup) main_window_error_message (const gchar * const markup)
{ {
main_window_message (GTK_MESSAGE_ERROR, markup); main_window_message (GTK_MESSAGE_ERROR, markup);
} }
void void
main_window_warning_message (gchar * markup) main_window_warning_message (const gchar * const markup)
{ {
main_window_message (GTK_MESSAGE_WARNING, markup); main_window_message (GTK_MESSAGE_WARNING, markup);
} }
void void
main_window_info_message (gchar * markup) main_window_info_message (const gchar * const markup)
{ {
main_window_message (GTK_MESSAGE_INFO, markup); main_window_message (GTK_MESSAGE_INFO, markup);
} }
...@@ -386,11 +385,9 @@ main_window_dialpad (gboolean state) ...@@ -386,11 +385,9 @@ main_window_dialpad (gboolean state)
gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/, gtk_box_pack_end (GTK_BOX (subvbox), dialpad, FALSE /*expand*/,
TRUE /*fill*/, 0 /*padding*/); TRUE /*fill*/, 0 /*padding*/);
gtk_widget_show_all (dialpad); gtk_widget_show_all (dialpad);
} else { } else
gtk_container_remove (GTK_CONTAINER (subvbox), dialpad); gtk_container_remove (GTK_CONTAINER (subvbox), dialpad);
} }
}
void void
main_window_volume_controls (gboolean state) main_window_volume_controls (gboolean state)
...@@ -411,7 +408,7 @@ main_window_volume_controls (gboolean state) ...@@ -411,7 +408,7 @@ main_window_volume_controls (gboolean state)
} }
void void
statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_message, guint id) statusbar_push_message (const gchar * const left_hand_message, const gchar * const right_hand_message, guint id)
{ {
// The actual message to be push in the statusbar // The actual message to be push in the statusbar
gchar *message_to_display; gchar *message_to_display;
...@@ -444,7 +441,7 @@ statusbar_pop_message (guint id) ...@@ -444,7 +441,7 @@ statusbar_pop_message (guint id)
} }
void void
statusbar_update_clock (gchar *msg) statusbar_update_clock (const gchar * const msg)
{ {
gchar *message = NULL; gchar *message = NULL;
...@@ -520,8 +517,8 @@ main_window_zrtp_not_supported (callable_obj_t * c) ...@@ -520,8 +517,8 @@ main_window_zrtp_not_supported (callable_obj_t * c)
} }
void void
main_window_zrtp_negotiation_failed (const gchar* callID, const gchar* reason, main_window_zrtp_negotiation_failed (const gchar* const callID, const gchar* const reason,
const gchar* severity) const gchar* const severity)
{ {
gchar* peer_number = "(number unknown)"; gchar* peer_number = "(number unknown)";
callable_obj_t * c = NULL; callable_obj_t * c = NULL;
......
...@@ -78,19 +78,19 @@ void main_window_volume_controls (gboolean state); ...@@ -78,19 +78,19 @@ void main_window_volume_controls (gboolean state);
* Display an error message * Display an error message
* @param markup The error message * @param markup The error message
*/ */
void main_window_error_message (gchar * markup); void main_window_error_message (const gchar * const markup);
/** /**
* Display a warning message * Display a warning message
* @param markup The warning message * @param markup The warning message
*/ */
void main_window_warning_message (gchar * markup); void main_window_warning_message (const gchar * const markup);
/** /**
* Display an info message * Display an info message
* @param markup The info message * @param markup The info message
*/ */
void main_window_info_message (gchar * markup); void main_window_info_message (const gchar * const markup);
/** /**
* Push a message on the statusbar stack * Push a message on the statusbar stack
...@@ -98,7 +98,7 @@ void main_window_info_message (gchar * markup); ...@@ -98,7 +98,7 @@ void main_window_info_message (gchar * markup);
* @param right_hand_message The message to display on the right side * @param right_hand_message The message to display on the right side
* @param id The identifier of the message * @param id The identifier of the message
*/ */
void statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_message, guint id); void statusbar_push_message (const gchar * const left_hand_message, const gchar * const right_hand_message, guint id);
/** /**
* Pop a message from the statusbar stack * Pop a message from the statusbar stack
...@@ -110,7 +110,7 @@ void statusbar_pop_message (guint id); ...@@ -110,7 +110,7 @@ void statusbar_pop_message (guint id);
* Update selected call's clock in statusbar * Update selected call's clock in statusbar
* @param id The identifier of the message * @param id The identifier of the message
*/ */
void statusbar_update_clock (gchar *time); void statusbar_update_clock (const gchar * const time);
gboolean focus_is_on_calltree; gboolean focus_is_on_calltree;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment