summaryrefslogtreecommitdiff
path: root/lib/resource.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-09-04 11:24:08 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-09-04 11:24:08 +0200
commitdaeeb8e982a3463f4a866e805b64f214d9f44160 (patch)
tree64888a5b01ab18f6ffca311af766c242f8c3b1bc /lib/resource.c
parent05198c12f48c9d4a65ee6d1d4117bd8067a71131 (diff)
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.
Diffstat (limited to 'lib/resource.c')
-rw-r--r--lib/resource.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/resource.c b/lib/resource.c
index 8f91450c..a4d87517 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);