I have char* array and I am dynamically allocating memory for it.
char *strData = new char[length+1];
This char* I am passing to _bstr_t as below,
_bstr_t bstrData = strData;
How to free up the memory allocated for the char* through bstrData ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
_bstr_tmanages its own internal buffer (created by SysAllocString). So once you create the_bstr_t, it’s safe to delete the char array you’ve allocated.bstrDatawill still be absolutely useful.