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