Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > a93d147f7c4ed0b9fc9239cc1f532e95 > files > 5

links-2.20-1.mga6.src.rpm

--- links-2.15/types.c	2018-03-11 14:36:26.000000000 +0100
+++ links-2.15/types.c.new	2018-04-30 11:45:48.144760240 +0200
@@ -371,6 +371,7 @@
 
 void update_assoc(struct assoc *neww)
 {
+	struct assoc *repl_found = 0;
 	struct assoc *repl;
 	struct list *r;
 	struct list_head *lr;
@@ -379,7 +380,6 @@
 		repl = get_struct(r, struct assoc, head);
 		if (!strcmp(cast_const_char repl->label, cast_const_char neww->label)
 		 && !strcmp(cast_const_char repl->ct, cast_const_char neww->ct)
-		 && !strcmp(cast_const_char repl->prog, cast_const_char neww->prog)
 		 && repl->block == neww->block
 		 && repl->cons == neww->cons
 		 && repl->xwin == neww->xwin
@@ -387,12 +387,14 @@
 		 && repl->accept_http == neww->accept_http
 		 && repl->accept_ftp == neww->accept_ftp
 		 && repl->system == neww->system) {
+			mem_free(repl->ct);
+			mem_free(repl->prog);
+			mem_free(repl->label);
 			del_from_list(&repl->head);
-			add_to_list(assoc.list_entry, &repl->head);
-			return;
+			repl_found = repl;
 		}
 	}
-	repl = mem_calloc(sizeof(struct assoc));
+	repl = repl_found ? repl_found : mem_calloc(sizeof(struct assoc));
 	repl->label = stracpy(neww->label);
 	repl->ct = stracpy(neww->ct);
 	repl->prog = stracpy(neww->prog);