From daeeb8e982a3463f4a866e805b64f214d9f44160 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 4 Sep 2009 11:24:08 +0200 Subject: Clear memory allocated by ralloc(). This also fixes bug that timer->recurrent was not cleared in tm_new() and unexpected recurrence of startup timer in BGP confused state machine and caused crash. --- lib/resource.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/resource.c') diff --git a/lib/resource.c b/lib/resource.c index 8f91450..a4d8751 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -183,13 +183,14 @@ rdump(void *res) * * This function is called by the resource classes to create a new * resource of the specified class and link it to the given pool. - * Size of the resource structure is taken from the @size field - * of the &resclass. + * Allocated memory is zeroed. Size of the resource structure is taken + * from the @size field of the &resclass. */ void * ralloc(pool *p, struct resclass *c) { resource *r = xmalloc(c->size); + bzero(r, c->size); r->class = c; add_tail(&p->inside, &r->n); -- cgit v1.2.3 From 46eb80d5d50a2b284cae19444149d57d857a8e02 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 17 Sep 2009 17:52:36 +0200 Subject: Fixes headers for uintptr_t (and build on NetBSD). --- lib/resource.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/resource.c') diff --git a/lib/resource.c b/lib/resource.c index a4d8751..5ba23f1 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -8,6 +8,7 @@ #include #include +#include #include "nest/bird.h" #include "lib/resource.h" -- cgit v1.2.3