Skip to content
Snippets Groups Projects
Commit eb26ddb5 authored by Timo Teräs's avatar Timo Teräs
Browse files

main/gdnsd: remove unused patches

parent a274400e
No related branches found
No related tags found
No related merge requests found
From e4d663a531205cdb281318bc912d76f2be22b328 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 11 Jul 2013 18:47:22 +0300
Subject: [PATCH 1/2] Fix ztree_txn_* API to work
ztree_clone() sets ztclone->zones to valid pointer even where
it was NULL in the original ztree. This happens since malloc(0)
returns always valid pointer. This confuses _ztree_update() and
various other places as in several cases ->zones is tested
instead of ->zones_len.
Fix ztree_clone() to keep ->zones as NULL if the original had
it as NULL.
---
gdnsd/ztree.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/gdnsd/ztree.c b/gdnsd/ztree.c
index 57ff6d6..3924504 100644
--- a/gdnsd/ztree.c
+++ b/gdnsd/ztree.c
@@ -526,9 +526,14 @@ static ztree_t* ztree_clone(const ztree_t* original) {
ztree_t* ztclone = malloc(sizeof(ztree_t));
ztclone->label = original->label;
- ztclone->zones = malloc(original->zones_len * sizeof(zone_t*));
- memcpy(ztclone->zones, original->zones, original->zones_len * sizeof(zone_t*));
- ztclone->zones_len = original->zones_len;
+ if (original->zones) {
+ ztclone->zones = malloc(original->zones_len * sizeof(zone_t*));
+ memcpy(ztclone->zones, original->zones, original->zones_len * sizeof(zone_t*));
+ ztclone->zones_len = original->zones_len;
+ } else {
+ ztclone->zones = NULL;
+ ztclone->zones_len = 0;
+ }
ztchildren_t* old_ztc = original->children;
if(old_ztc) {
ztchildren_t* new_ztc = ztclone->children = calloc(1, sizeof(ztchildren_t));
--
1.8.3.2
This diff is collapsed.
diff -ru gdnsd-1.11.3.orig/gdnsd/zscan_djb.c gdnsd-1.11.3/gdnsd/zscan_djb.c
--- gdnsd-1.11.3.orig/gdnsd/zscan_djb.c 2014-08-01 08:22:55.000000000 -0300
+++ gdnsd-1.11.3/gdnsd/zscan_djb.c 2014-08-01 08:49:37.338082860 -0300
@@ -226,6 +226,9 @@
unsigned int i;
unsigned int j;
+ if (f->len < 2)
+ return;
+
j = 0;
i = 0;
while (i < f->len) {
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment