summaryrefslogtreecommitdiff
path: root/src/shared/conf-parser.h
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-09-17 22:17:53 +0200
committerTom Gundersen <teg@jklm.no>2014-09-17 22:19:53 +0200
commit83e341a637b75f7f592a5dc717c34d8b67ed4ffa (patch)
tree2b4b72378889c1594cd3cde0fc66f77bcbe74c2a /src/shared/conf-parser.h
parent19c784c414e6f2b35a268034905e1db226e905f6 (diff)
shared: conf-parser
Check memory allocation. Found by Coverity. Fixes CID #1237644.
Diffstat (limited to 'src/shared/conf-parser.h')
-rw-r--r--src/shared/conf-parser.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index a17dde9069..94185152cd 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -179,6 +179,9 @@ int log_syntax_internal(const char *unit, int level,
assert(data); \
\
xs = new0(type, 1); \
+ if(!xs) \
+ return -ENOMEM; \
+ \
*xs = invalid; \
\
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)); \
if (!xs) \
return -ENOMEM; \
+ \
*(xs + i) = invalid; \
} \
\