From 6ec040f5c9162546b43c1b16956010af1a7bcc60 Mon Sep 17 00:00:00 2001 From: Arnav Singh Date: Mon, 12 Nov 2012 00:06:05 -0800 Subject: utf8-everywhere: Forgot the g_free's and the g_unlink / g_rename. --- src/common/cfgfiles.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/common/cfgfiles.c') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index b31d7e37..273d1e49 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -844,23 +844,23 @@ int save_config (void) { int fh, i; - char *new_config, *config; + char *config, *new_config; check_prefs_dir (); config = default_file (); - new_config = g_strdup_printf ("%s.new", config); + new_config = g_strconcat (config, ".new"); fh = g_open (new_config, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT, 0600); if (fh == -1) { - free (new_config); + g_free (new_config); return 0; } if (!cfg_put_str (fh, "version", PACKAGE_VERSION)) { - free (new_config); + g_free (new_config); return 0; } @@ -872,7 +872,7 @@ save_config (void) case TYPE_STR: if (!cfg_put_str (fh, vars[i].name, (char *) &prefs + vars[i].offset)) { - free (new_config); + g_free (new_config); return 0; } break; @@ -880,7 +880,7 @@ save_config (void) case TYPE_BOOL: if (!cfg_put_int (fh, *((int *) &prefs + vars[i].offset), vars[i].name)) { - free (new_config); + g_free (new_config); return 0; } } @@ -890,19 +890,19 @@ save_config (void) if (close (fh) == -1) { - free (new_config); + g_free (new_config); return 0; } #ifdef WIN32 - unlink (config); /* win32 can't rename to an existing file */ + g_unlink (config); /* win32 can't rename to an existing file */ #endif - if (rename (new_config, config) == -1) + if (g_rename (new_config, config) == -1) { - free (new_config); + g_free (new_config); return 0; } - free (new_config); + g_free (new_config); return 1; } -- cgit 1.4.1