Blame SOURCES/dhcp-dns_client_cancelupdate.patch

45d60a
diff -up dhcp-4.2.5/client/dhclient.c.dns_client_cancelupdate dhcp-4.2.5/client/dhclient.c
45d60a
--- dhcp-4.2.5/client/dhclient.c.dns_client_cancelupdate	2015-06-25 14:31:27.309035906 +0200
45d60a
+++ dhcp-4.2.5/client/dhclient.c	2015-06-25 14:34:26.477642016 +0200
45d60a
@@ -121,6 +121,8 @@ static int check_option_values(struct un
45d60a
 			       const char *ptr, size_t len);
45d60a
 
45d60a
 static void setup_ib_interface(struct interface_info *ip);
45d60a
+static void dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb,
45d60a
+                                   char* file, int line);
45d60a
 
45d60a
 int
45d60a
 main(int argc, char **argv) {
45d60a
@@ -4306,7 +4308,7 @@ client_dns_remove_action(dhcp_ddns_cb_t
45d60a
 	}
45d60a
 
45d60a
 	/* If we are done or have an error clean up */
45d60a
-	ddns_cb_free(ddns_cb, MDL);
45d60a
+	dhclient_ddns_cb_free(ddns_cb, MDL);
45d60a
 	return;
45d60a
 }
45d60a
 
45d60a
@@ -4335,7 +4337,7 @@ client_dns_remove(struct client_state *c
45d60a
 		result = client_dns_update(client, ddns_cb);
45d60a
 
45d60a
 		if (result != ISC_R_TIMEDOUT) {
45d60a
-			ddns_cb_free(ddns_cb, MDL);
45d60a
+			dhclient_ddns_cb_free(ddns_cb, MDL);
45d60a
 		}
45d60a
 	}
45d60a
 }
45d60a
@@ -4418,10 +4420,7 @@ client_dns_update_timeout (void *cp)
45d60a
 	 * the control block and should free it.
45d60a
 	 */
45d60a
 	if (status != ISC_R_TIMEDOUT) {
45d60a
-		if (client != NULL) {
45d60a
-			client->ddns_cb = NULL;
45d60a
-		}
45d60a
-		ddns_cb_free(ddns_cb, MDL);
45d60a
+		dhclient_ddns_cb_free(ddns_cb, MDL);
45d60a
 	}
45d60a
 }
45d60a
 
45d60a
@@ -4510,7 +4509,7 @@ client_dns_update_action(dhcp_ddns_cb_t
45d60a
 		return;
45d60a
 	}
45d60a
 
45d60a
-	ddns_cb_free(ddns_cb, MDL);
45d60a
+	dhclient_ddns_cb_free(ddns_cb, MDL);
45d60a
 	return;
45d60a
 }
45d60a
 
45d60a
@@ -4873,3 +4872,17 @@ add_reject(struct packet *packet) {
45d60a
 	 */
45d60a
 	log_info("Server added to list of rejected servers.");
45d60a
 }
45d60a
+
45d60a
+/* Wrapper function around common ddns_cb_free function that ensures
45d60a
+ * we set the client_state pointer to the control block to NULL. */
45d60a
+static void
45d60a
+dhclient_ddns_cb_free(dhcp_ddns_cb_t *ddns_cb, char* file, int line) {
45d60a
+    if (ddns_cb) {
45d60a
+        struct client_state *client = (struct client_state *)ddns_cb->lease;
45d60a
+        if (client != NULL) {
45d60a
+            client->ddns_cb = NULL;
45d60a
+        }
45d60a
+
45d60a
+        ddns_cb_free(ddns_cb, file, line);
45d60a
+    }
45d60a
+}