about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_conf.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index 15a59072f3..15e930360f 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -202,12 +202,14 @@ insert_module (struct gconv_module *newp, int tobefreed)
 		  || (newp->cost_hi == root->cost_hi
 		      && newp->cost_lo < root->cost_lo))
 		{
-		  root->cost_hi = newp->cost_hi;
-		  root->cost_lo = newp->cost_lo;
-		  root->module_name = newp->module_name;
-		}
+		  newp->left = root->left;
+		  newp->right = root->right;
+		  newp->same = root->same;
+		  *rootp = newp;
 
-	      if (tobefreed)
+		  free (root);
+		}
+	      else if (tobefreed)
 		free (newp);
 	      return;
 	    }