shared: conf-parser
Check memory allocation. Found by Coverity. Fixes CID #1237644.
This commit is contained in:
parent
19c784c414
commit
83e341a637
|
@ -179,6 +179,9 @@ int log_syntax_internal(const char *unit, int level,
|
||||||
assert(data); \
|
assert(data); \
|
||||||
\
|
\
|
||||||
xs = new0(type, 1); \
|
xs = new0(type, 1); \
|
||||||
|
if(!xs) \
|
||||||
|
return -ENOMEM; \
|
||||||
|
\
|
||||||
*xs = invalid; \
|
*xs = invalid; \
|
||||||
\
|
\
|
||||||
FOREACH_WORD(word, l, rvalue, state) { \
|
FOREACH_WORD(word, l, rvalue, state) { \
|
||||||
|
@ -211,6 +214,7 @@ int log_syntax_internal(const char *unit, int level,
|
||||||
xs = realloc(xs, (++i + 1) * sizeof(type)); \
|
xs = realloc(xs, (++i + 1) * sizeof(type)); \
|
||||||
if (!xs) \
|
if (!xs) \
|
||||||
return -ENOMEM; \
|
return -ENOMEM; \
|
||||||
|
\
|
||||||
*(xs + i) = invalid; \
|
*(xs + i) = invalid; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Reference in a new issue