title: Calling malloc multiple times
body: <p>What happens when you call malloc() multiple times on same variable? How should I free previously allocated memory? I am planning to use struct iovec to store data (so that I can send/write these chunks later). Before calling each malloc, I would like to save current reference to iovec array. After doing this, I will call malloc on same variable to get new memory block of fixed size. After it's exhausted, I will save it in iovec array and call malloc again and so on. Can I free iovec array later? Please let me know if this is the right approach or suggest any better alternative way? </p>