There was a double free issue caused by virSysinfoRead on s390,
as the same manufacturer string instance was assigned to more
than one processor record.
Cleaned up other potential memory issues and restructured the sysinfo
parsing code by moving repeating patterns into a helper function.
BTW: I hit an issue with using strchr(string,variable), as I am
still compiling with gcc 4.4.x, see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
I circumvented this using index(), which is deprecated, but working.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/util/sysinfo.c | 160 ++++++++++++++++++++++-----------------------------
1 files changed, 69 insertions(+), 91 deletions(-)
Given the complexity the parsing it would be nice to add a test
case for this. It is a shame we don't already have a test case
for the sysinfo code in fact :-( I'd like to see test/virsysinfotest.c
to validate this parsing. Take a 'char *str' containing representation
data from /proc/sysinfo, run it through the parser & then validate the
result.
Daniel
--
|: