char* XX (char* str) { // CONCAT an existing string with str , and return to user }
And i call this program by:
XX ( strdup("CHCHCH") );
Will this cause a leak while not releasing what strdup()
generates ?
It's unlikely that free the result of XX()
will do the job.
(Please let me know both in C and C++ , thanks !)
Unless the XX function free()'s the argument passed in, yes this will cause a memory leak in both C and C++.