Module: sip-router Branch: master Commit: 831a9a4876fbcb2b47f82644bc29cb6ce5f265c4 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=831a9a48...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Sat Jul 16 23:24:42 2011 +0200
core: exit if addstr() cannot get pkg memory
- if parsing config file has no enough pkg memory do exit(-1) instead of returning null pointer, makes no sense to continue and there are no safety checks for the return of addstr(), causing crash anyhow
---
cfg.lex | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/cfg.lex b/cfg.lex index 83a5879..7b984f1 100644 --- a/cfg.lex +++ b/cfg.lex @@ -1404,7 +1404,9 @@ static char* addstr(struct str_buf* dst_b, char* src, int len) return dst_b->s; error: LOG(L_CRIT, "ERROR:lex:addstr: memory allocation error\n"); - return 0; + LOG(L_CRIT, "ERROR:lex:addstr: try to increase pkg size with" + " -M parameter\n"); + exit(-1); }