SHA256
1
0
forked from pool/systemd
systemd/0004-shared-conf-parser.patch

32 lines
1.7 KiB
Diff
Raw Normal View History

Based on 83e341a637b75f7f592a5dc717c34d8b67ed4ffa Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 17 Sep 2014 22:17:53 +0200
Subject: [PATCH] shared: conf-parser
Check memory allocation. Found by Coverity.
Fixes CID #1237644.
---
src/shared/conf-parser.h | 4 ++++
1 file changed, 4 insertions(+)
--- src/shared/conf-parser.h
+++ src/shared/conf-parser.h 2014-09-18 13:07:07.314735514 +0000
@@ -181,6 +181,8 @@ int log_syntax_internal(const char *unit
assert(data); \
\
xs = new0(type, 1); \
+ if(!xs) \
+ return -ENOMEM; \
*xs = invalid; \
\
FOREACH_WORD(w, l, rvalue, state) { \
@@ -213,6 +215,7 @@ int log_syntax_internal(const char *unit
xs = realloc(xs, (++i + 1) * sizeof(type)); \
if (!xs) \
return -ENOMEM; \
+ \
*(xs + i) = invalid; \
} \
\