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:
6301a98
)
conf-parser: fix memory realloc error
author
Yin Kangkai
<kangkai.yin@intel.com>
Mon, 25 Nov 2013 15:14:46 +0000
(23:14 +0800)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 25 Nov 2013 22:39:11 +0000
(23:39 +0100)
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.
src/shared/conf-parser.h
patch
|
blob
|
history
diff --git
a/src/shared/conf-parser.h
b/src/shared/conf-parser.h
index 42602b3b085bae7c8b2a822409ef48a80e48bf5a..2d5aa31c3b244056e141f6c4aa72e624fbcafc14 100644
(file)
--- 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; \