Explorar o código

- fix for free_rdata_list() which used to access the "next" pointer after
freeing the current elements.
Credits & patch: Jan Andres <[email protected]>

Andrei Pelinescu-Onciul %!s(int64=19) %!d(string=hai) anos
pai
achega
54ff79d2aa
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      resolve.c

+ 5 - 1
resolve.c

@@ -367,10 +367,14 @@ error:
 void free_rdata_list(struct rdata* head)
 {
 	struct rdata* l;
-	for(l=head; l; l=l->next){
+	struct rdata* next_l;
+	l=head;
+	while (l != 0) {
+		next_l = l->next;
 		/* free the parsed rdata*/
 		if (l->rdata) local_free(l->rdata);
 		local_free(l);
+		l = next_l;
 	}
 }