chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
19c784c
)
shared: conf-parser
author
Tom Gundersen
<teg@jklm.no>
Wed, 17 Sep 2014 20:17:53 +0000
(22:17 +0200)
committer
Tom Gundersen
<teg@jklm.no>
Wed, 17 Sep 2014 20:19:53 +0000
(22:19 +0200)
Check memory allocation. Found by Coverity.
Fixes CID #
1237644
.
src/shared/conf-parser.h
patch
|
blob
|
history
diff --git
a/src/shared/conf-parser.h
b/src/shared/conf-parser.h
index a17dde90699b8e5814cc7c2d52e0912b963aa5aa..94185152cdecda1eb519925673d0c42d435c7cd0 100644
(file)
--- 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; \
} \
\