2013-08-29 11:46 AM
Assuming that I have done the following:
na_elem_t *pElem1 = NULL;
na_elem_t *pElem2 = NULL;
na_elem_t *pElem3 = NULL;
pElem1 = na_elem_new("Element #1");
pElem2 = na_elem_new("Element #2");
pElem3 = na_child_add(pElem1, pElem2);
I then note that pElem3 == pElem2.
Is it safe to assume that I only need to call na_elem_free() for pElem1 at this point because element #1 now "owns" the memory that was allocated to element #2, and calling na_elem_free() for element #1 will result in freeing the memory for both element #1 and element #2?
Solved! SEE THE SOLUTION