#ifndef SAFE_ADDREF
#define SAFE_ADDREF(p) if (p != NULL) { p->AddRef(); }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) if (p != NULL) { p->Release(); p = NULL; }
#endif
#define SAFE_DELETE(x) {if ((x)!=NULL) {delete (x); (x)=NULL;}}
#define SAFE_DELETEBUFF(x) {if((x)!=NULL) {delete [] (x); (x) = NULL;}}
#define SAFE_FREE(x) {if((x)!=NULL) {free(x); (x) = NULL;}}
int *b = new int[4];
b[0] = 1;
b[1] = 2;
b[2] = 3;
b[3] = 4;
b[4] = '\0';
delete[] b;
b = NULL
char *array = (char*) malloc(sizeof(char) * 5);
array[0] = 'a';
array[1] = 'b';
array[2] = 'c';
array[3] = 'd';
array[4] = '\0';
free(array);
array = NULL;