[Open-scap] Patch for TODO: The light dawns
David Niemoller
David.Niemoller at g2-inc.com
Thu Jul 30 16:36:12 UTC 2009
Yes, I see it. Removing the "free(variableId)" in
"oval_variable_parse_tag" would solve this problem and be consistent
with other uses of get_oval_***_new. Going forward, however, I'll
review the uses of xmlchar* xmlTextReader*** and see if there isn't a
more disciplined and consistent way of using this pattern through the
application of malloc_string. BTW the crash is still not occurring on
my windows test computer, but it would manifest eventually.
Dave.
-----Original Message-----
From: Peter Vrabec [mailto:pvrabec at redhat.com]
Sent: Thursday, July 30, 2009 11:21 AM
To: David Niemoller
Cc: open-scap-list at redhat.com
Subject: Re: [Open-scap] Patch for TODOs
On Thursday 30 July 2009 04:59:12 pm David Niemoller wrote:
> Whoops! I am not able to reproduce the crash. The cause may be that
> my code base is not synched with yours despite my efforts and the TODO
> patch failed against your code base. I'm including the code that I'm
> actually running (this includes my TODO patch). Could you test this
> and determine whether it has the same problem?
Same problem :(
Please take a look at:
oval_variableBinding.c:oval_variable_binding_parse_tag()
...
char* variableId = xmlTextReaderGetAttribute(reader, BAD_CAST
"variable_id"); struct oval_variable *variable =
get_oval_variable_new(context->model,
variableId);
set_oval_variable_binding_variable(binding, variable); free(variableId);
....
but variableId is freed in
oval_agent.c:get_oval_variable_new()
struct oval_state *state = get_oval_state(model, id); if (state == NULL)
{
state = oval_state_new();
set_oval_state_id(state, id);
add_oval_state(model, state);
} else {
free(id);
}
I have attached system-characteristics.xml file that we parse.
> -----Original Message-----
> From: Peter Vrabec [mailto:pvrabec at redhat.com]
> Sent: Thursday, July 30, 2009 10:36 AM
> To: open-scap-list at redhat.com
> Cc: David Niemoller
> Subject: Re: [Open-scap] Patch for TODOs
>
> Hi David,
>
> thnx. for update. But unfortunately it breaks populating of system
> characteristic. :)
>
> $make check
> ....
> + ./test_syschar ./OVAL/composed-oval.xml
> ./OVAL/system-characteristics.xml
>
> START
>
> LOAD OVAL DEFINITIONS
>
> OVAL DEFINITIONS LOADED
>
> LOAD OVAL SYSCHAR
>
> *** glibc detected ***
> /home/pvrabec/openscap/examples/.libs/lt-test_syschar:
> double free or corruption (fasttop): 0x0000000002504200 ***
>
> ======= Backtrace: =========
>
> /lib64/libc.so.6[0x3efd875a26]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(oval_variable_binding_
> parse_tag+0x6c)
> [0x7f4bd9ab31ac]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(_oval_syschar_parse_su
> btag+0x135)
> [0x7f4bd9ab1c65]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(oval_parser_parse_tag+
> 0xa4)
> [0x7f4bd9aae524]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(oval_syschar_parse_tag
> +0x236)
> [0x7f4bd9ab1a36]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(oval_parser_parse_tag+
> 0xa4)
> [0x7f4bd9aae524]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(_ovalsys_parser_proces
> s_node+0x264)
> [0x7f4bd9ab35c4]
>
>
/home/pvrabec/openscap/src/.libs/libopenscap.so.0(ovalsys_parser_parse+0
> x15b)
> [0x7f4bd9ab373b]
> ...
>
> On Thursday 30 July 2009 03:39:29 pm David Niemoller wrote:
> > Please find attached some source updates that address several of
TODOs
> > in the current code base.
More information about the Open-scap-list
mailing list