diff options
author | Yin Kangkai <kangkai.yin@intel.com> | 2013-11-25 23:14:46 +0800 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-25 23:39:11 +0100 |
commit | 4ae7885c2c4d89e1149c3fb186a4fe3b49787cc7 (patch) | |
tree | a6cd1870387df0a5ee422c187774a99b8dbb9a29 /src/shared/conf-parser.h | |
parent | 6301a98cdf26dc073f5317506c806bfa69f74cc8 (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/conf-parser.h')
-rw-r--r-- | src/shared/conf-parser.h | 2 |
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; \ |