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.
This commit is contained in:
committed by
Lennart Poettering
parent
6301a98cdf
commit
4ae7885c2c
@@ -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; \
|
||||
|
||||
Reference in New Issue
Block a user