diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c
index 974c726ec856ce314bc433356ebeac9838cfb44e..bf120aa4d2e99628a747e026727b678c3c2cd8a9 100644
--- a/src/xpdev/ini_file.c
+++ b/src/xpdev/ini_file.c
@@ -280,6 +280,10 @@ BOOL iniRenameSection(str_list_t* list, const char* section, const char* newname
 	if(section==ROOT_SECTION)
 		return(FALSE);
 
+	i=find_section_index(*list,newname);
+	if((*list)[i]!=NULL)	/* duplicate */
+		return(FALSE);
+
 	i=find_section_index(*list,section);
 	if((*list)[i]==NULL)	/* not found */
 		return(FALSE);