summary refs log tree commit diff stats
path: root/src/common/servlist.c
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-19 12:17:37 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-19 12:17:37 +0200
commit5fa23341b38280e7451a512dc95df58851fcb471 (patch)
treed7467164b5c8c4558006a18c25baee66bd00a59e /src/common/servlist.c
parent67274f91e92e38f5c4e42bbc4a61e40ff85f9f67 (diff)
Avoid useless strdup() and free() calls
Diffstat (limited to 'src/common/servlist.c')
-rw-r--r--src/common/servlist.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common/servlist.c b/src/common/servlist.c
index 52985a60..d121dd47 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -1194,15 +1194,17 @@ servlist_load_defaults (void)
 		if (def[i].network)
 		{
 			net = servlist_net_add (def[i].network, def[i].host, FALSE);
-			net->encoding = strdup (IRC_DEFAULT_CHARSET);
 			if (def[i].channel)
 			{
 				servlist_favchan_add (net, def[i].channel);
 			}
 			if (def[i].charset)
 			{
-				free (net->encoding);
-				net->encoding = strdup (def[i].charset);
+				net->encoding = g_strdup (def[i].charset);
+			}
+			else
+			{
+				net->encoding = g_strdup (IRC_DEFAULT_CHARSET);
 			}
 			if (def[i].loginmode)
 			{