From 17c1072595258edfd1057fe8aa911f06716feed6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 29 Aug 2015 01:49:03 +0200 Subject: [PATCH] fix compilation warning --- gtk/chat.c | 8 +++----- gtk/linphone.h | 2 +- gtk/main.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gtk/chat.c b/gtk/chat.c index 05f13afe3..3f3670e75 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -31,13 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CONFIG_FILE ".linphone-history.db" -const char *linphone_gtk_message_storage_get_db_file(const char *filename){ +char *linphone_gtk_message_storage_get_db_file(const char *filename){ const int path_max=1024; - static char *db_file=NULL; + char *db_file=NULL; - if (db_file) return db_file; - - db_file=(char *)malloc(path_max*sizeof(char)); + db_file=(char *)g_malloc(path_max*sizeof(char)); if (filename==NULL) filename=CONFIG_FILE; /*try accessing a local file first if exists*/ if (access(CONFIG_FILE,F_OK)==0){ diff --git a/gtk/linphone.h b/gtk/linphone.h index f931f1cf3..0f992bf2a 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -100,7 +100,7 @@ LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_window(const char *window_name, G LINPHONE_PUBLIC GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name); LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_widget(const char* widget_name); -const char *linphone_gtk_message_storage_get_db_file(const char *filename); +char *linphone_gtk_message_storage_get_db_file(const char *filename); LINPHONE_PUBLIC void linphone_gtk_show_assistant(GtkWidget* parent); LINPHONE_PUBLIC void linphone_gtk_close_assistant(void); diff --git a/gtk/main.c b/gtk/main.c index 8992feaed..af4d13d80 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -2063,7 +2063,7 @@ int main(int argc, char *argv[]){ GdkPixbuf *pbuf; const char *app_name="Linphone"; LpConfig *factory; - const char *db_file; + char *db_file; GError *error=NULL; const char *tmp; @@ -2215,7 +2215,7 @@ core_start: db_file=linphone_gtk_message_storage_get_db_file(NULL); linphone_gtk_init_liblinphone(config_file, factory_config_file, db_file); - free(db_file); + g_free(db_file); /* do not lower timeouts under 30 ms because it exhibits a bug on gtk+/win32, with cpu running 20% all the time...*/ gtk_timeout_add(30,(GtkFunction)linphone_gtk_iterate,(gpointer)linphone_gtk_get_core());