1 Reply Latest reply: Aug 30, 2013 10:14 AM by rkiran RSS

Question about Core API function na_child_add() and na_elem_free()

Currently Being Moderated

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?

More Like This

  • Retrieving data ...