(rs_context_create): Don't touch *ctx on failure. Keep allocation and
zeroing of allocated memory together.
(rs_context_destroy): Fix typo.
(rs_context_destroy): Don't rs_free the context since it's allocated
with calloc.
- if (ctx)
- *ctx = NULL;
- h = (struct rs_context *) malloc (sizeof(struct rs_context));
- if (!h)
+ h = calloc (1, sizeof(*h));
+ if (h == NULL)
return RSE_NOMEM;
#if defined (RS_ENABLE_TLS)
return RSE_NOMEM;
#if defined (RS_ENABLE_TLS)
#endif
debug_init ("libradsec"); /* radsecproxy compat, FIXME: remove */
#endif
debug_init ("libradsec"); /* radsecproxy compat, FIXME: remove */
- memset (h, 0, sizeof(struct rs_context));
fr_randinit (&h->fr_randctx, 0);
fr_rand_seed (NULL, 0);
fr_randinit (&h->fr_randctx, 0);
fr_rand_seed (NULL, 0);
p = p->next;
rs_free (ctx, tmp);
}
p = p->next;
rs_free (ctx, tmp);
}
r = r->next;
rs_free (ctx, tmp);
}
r = r->next;
rs_free (ctx, tmp);
}
rs_free (ctx, ctx->config);
}
rs_free (ctx, ctx->config);
}