Software Development Kit (SDK) and API Discussions

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

eshropshire

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?

1 ACCEPTED SOLUTION

rkiran

Yes, you just need to call na_elem_free() for element #1 that will result in freeing the memory for both element #1 and element #2.

View solution in original post

1 REPLY 1

rkiran

Yes, you just need to call na_elem_free() for element #1 that will result in freeing the memory for both element #1 and element #2.

View solution in original post

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public