DWORD len = SomeFunc();
if(len <=0)
return;
wchar_t* buffer = new buffer[len];
...manipulate here
delete [] buffer;
len = OtherFunc();
if(len <=0)
return;
buffer = new buffer[len];
...manipulate here
delete [] buffer;
...and so on
1. If you are sure that you won't loose track of dynamically allocated memory, you can use a pointer however you wish.
ie: before reassigning a pointer make sure that you deleted it.
2. nothing special, you allocated an array of one element and you'll delete an array of one element