Re: [systemd-devel] [PATCH] conf-parser: fix memory realloc error

2013-11-25 Thread Lennart Poettering
On Mon, 25.11.13 23:14, Yin Kangkai (kangkai@intel.com) wrote:

> 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.

Thanks! Applied!

> Signed-off-by: Yin Kangkai 

We don't do S-o-b in systemd, dropped this bit.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] conf-parser: fix memory realloc error

2013-11-25 Thread Yin Kangkai
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.

Signed-off-by: Yin Kangkai 
---
 src/shared/conf-parser.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 312315b..c194a07 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -199,7 +199,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;   
\
-- 
1.8.2.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel