فهرست منبع

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);
 }