提交 7a410bae 编写于 作者: K Kozlov Dmitry

radius: fix incorrect 'out of memory' message

上级 c82ae5ec
......@@ -232,10 +232,8 @@ int rad_acct_start(struct radius_pd_t *rpd)
return 0;
rpd->acct_req = rad_req_alloc(rpd, CODE_ACCOUNTING_REQUEST, rpd->ppp->username);
if (!rpd->acct_req) {
log_emerg("radius: out of memory\n");
if (!rpd->acct_req)
return -1;
}
if (rad_req_acct_fill(rpd->acct_req)) {
log_ppp_error("radius:acct: failed to fill accounting attributes\n");
......
......@@ -24,8 +24,10 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u
struct rad_plugin_t *plugin;
struct rad_req_t *req = _malloc(sizeof(*req));
if (!req)
if (!req) {
log_emerg("radius: out of memory\n");
return NULL;
}
memset(req, 0, sizeof(*req));
req->rpd = rpd;
......@@ -97,6 +99,10 @@ struct rad_req_t *rad_req_alloc(struct radius_pd_t *rpd, int code, const char *u
return req;
out_err:
if (!req->serv)
log_ppp_error("radius: no servers available\n");
else
log_emerg("radius: out of memory\n");
rad_req_free(req);
return NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册