summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorYin Kangkai <kangkai.yin@intel.com>2013-11-25 23:14:46 +0800
committerLennart Poettering <lennart@poettering.net>2013-11-25 23:39:11 +0100
commit4ae7885c2c4d89e1149c3fb186a4fe3b49787cc7 (patch)
treea6cd1870387df0a5ee422c187774a99b8dbb9a29 /src/shared
parent6301a98cdf26dc073f5317506c806bfa69f74cc8 (diff)
conf-parser: fix memory realloc error
Otherwise there is some memory corruption and undefined behavior, e.g., in my case systemd-udev was always aborted at the _cleanup_freep_ around that code blocks.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/conf-parser.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 42602b3b08..2d5aa31c3b 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -202,7 +202,7 @@ int log_syntax_internal(const char *unit, int level,
continue; \
\
*(xs + i) = x; \
- xs = realloc(xs, ++i + 1); \
+ xs = realloc(xs, (++i + 1) * sizeof(type)); \
if (!xs) \
return -ENOMEM; \
*(xs + i) = invalid; \