Please review. This patch fixes a few problems:
a. In handle_input(), which is called from main() in
xenstored_core.c, the conn->in is freed when there is no error, but
conn is freed when there is error. This is inconsistent. Moreover,
the conn is freed again upon exit from handle_input(), inside the
b. Another problem is that perms_to_strings() returned a allocated
memory (via realloc()). The only time the value is returned is in
do_get_perms(), but immediately after send_reply(), the pointer is
immediately thrown away, resulting in a memory leak condition, as
send_reply() does not free any memory.
c. Many of the functions like read_node(), get_parent(),
talloc_asprintf() etc all will allocate memory and return a pointer
when memory is allocated, but many times these are not freed.
Another problem identified but which I cannot fix, is that
create_hashtable() can return NULL in low memory condition. But this
is not checked in the recursive function check_store_(). There is no
value to specify error or not in the return value of check_store_()
(declared as void). May be we should change this to unsigned int or
something like that, so that error condition can be returned?
I am still making changes to the same file, but was hesitant to
incorporate so many changes as it will make the review more difficult.
I will submit these further changes in the next posting.
Description: Text Data
Xen-devel mailing list