sumit_tuwien Posted October 14, 2013 Report Posted October 14, 2013 We have discovered C-style dynamic memory allocation in following files: utils/sc_report.cpp utils/sc_hash.cpp utils/sc_report_handler.cpp utils/sc_mempool.cpp However, dynamic memory allocation for other C++ files have been done using C++ style new/delete. Our question: Can we replace them safely with new/delete or we will see some surprises ? In fact it seems they are legacy codes taken from somewhere and we can replace them safely. Example (utils/sc_report.cpp) ............ ............ static char empty_str[] = ""; static inline char * empty_dup(const char * p) { if ( p && *p ) { char* result; result = (char*)malloc(strlen(p)+1); // Very very legacy C style strcpy(result, p); return result; } else { return empty_str; } } ............ ............ Regards, Sumit Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.