It appears that you have a memory leak; somewhere you are allocating memory, such as from new, malloc, strdup, or other functions that allocate memory, and are not freeing it (delete or free).
Without your code, itβs impossible to say where it might be.
strdup() internally already allocates the required buffer to fit the copy in and you would need to catch the pointer returned by it to free() that memory again.
But even after getting rid of the memory leak you may run into heap fragmentation issues over time.
When you have these lines in a function and the string lengths are not excessive Iβd rather go with automatic variables.
e.g.