void CMyDlg::OnBnClickedButton2()
{         CBitmap bitmap;
HDC dc1= CreateCompatibleDC(NULL);
int bits=GetDeviceCaps(dc1,BITSPIXEL);
if(bits>24)
bits=24;
BITMAPINFO i;
ZeroMemory( &i.bmiHeader, sizeof(BITMAPINFOHEADER) );
i.bmiHeader.biWidth=5500;     // Set size you need
i.bmiHeader.biHeight=4250;    // Set size you need
i.bmiHeader.biPlanes=1;
i.bmiHeader.biBitCount=bits;  // Can be 8, 16, 32 bpp or 
// other number
i.bmiHeader.biSizeImage=0;
i.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
i.bmiHeader.biClrUsed= 0;
i.bmiHeader.biClrImportant= 0;
char *pvBits=new char[5500*4250*bits/8];
HBITMAP hbmp= CreateDIBSection( dc1,
&i,
DIB_RGB_COLORS,
(void **)&pvBits,
NULL,
0 );
bitmap.Attach(hbmp);
BITMAP bmp;
bitmap.GetBitmap((&bmp));
bitmap.Detach();
DeleteObject(hbmp);
DeleteObject(dc1);

在这个函数执行完后 pvbits new出来的空间不会释放 如果在函数末尾加上delete[] pvBits 或delete pvBits 都会出错,该如何释放申请出来的内存?