浏览代码

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
Daniel-Constantin Mierla 14 年之前
父节点
当前提交
831a9a4876
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      cfg.lex

+ 3 - 1
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);
 }