diff options
author | Arnav Singh <arnavion@gmail.com> | 2012-11-12 00:06:05 -0800 |
---|---|---|
committer | Arnav Singh <arnavion@gmail.com> | 2012-11-12 00:06:05 -0800 |
commit | 6ec040f5c9162546b43c1b16956010af1a7bcc60 (patch) | |
tree | 8d565fd7c58e43b81db3fb342ef590a2f0706e0e /src | |
parent | 0f26470169af253a10d173ded60394e107f14e91 (diff) |
utf8-everywhere: Forgot the g_free's and the g_unlink / g_rename.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/cfgfiles.c | 22 |
1 files changed, 11 insertions, 11 deletions
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; } |