Browse code

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 authored on 16/07/2011 21:24:42
Showing 1 changed files
... ...
@@ -1404,7 +1404,9 @@ static char* addstr(struct str_buf* dst_b, char* src, int len)
1404 1404
 	return dst_b->s;
1405 1405
 error:
1406 1406
 	LOG(L_CRIT, "ERROR:lex:addstr: memory allocation error\n");
1407
-	return 0;
1407
+	LOG(L_CRIT, "ERROR:lex:addstr: try to increase pkg size with"
1408
+					" -M parameter\n");
1409
+	exit(-1);
1408 1410
 }
1409 1411
 
1410 1412