求问关于C++重载操作符有关问题

求问关于C++重载操作符问题
现在编写一个程序,自己设计一个Image类存储位图信息。需要重载操作符-完成两幅位图相减。现在主程序
Image imgTemp = imgA - imgB调用重载的减法,重载减法代码如下:
Image operator(const Image &img1, const Image &img2){
                   Image temp1(img1);
Image temp2(img2);
int lineByte = temp1.getlineByte();
                int height = temp1.getbmpHeight();
unsigned char* bmpBuf = new unsigned char[lineByte * height];
for(int i = 0; i != height; i++)
for(int j = 0; j != lineByte; j++)
bmpBuf[i * lineByte + j] = unsigned char(0);
for(int i = 0; i != height; i++)
for(int j = 0; j != lineByte; j++){
   if((i * temp2.getlineByte() + j) < temp2.getlineByte() * temp2.getbmpHeight())
bmpBuf[i * lineByte + j] = 
temp1.getpBmpBuf()[i * lineByte + j] - temp2.getpBmpBuf()[i * temp2.getlineByte() + j];
}
temp1.setpBmpBuf(bmpBuf);
return temp2;
}
调用减法完成后,返回主函数后,显示imgTemp 和 imgB的pBmpBuf指针错误,调试的时候又转到dbgdel.cpp文件中,说是MemBlock堆指针中有错误,请问这是什么问题,如何解决?
------解决方案--------------------

//没调试过吗?具体是哪一行出错?是主函数退出之前报的错,还 是在operator=中出的错?
Image operator-(const Image &img1, const Image &img2){
               Image temp1(img1);
               Image temp2(img2);
                ...(对temp1操作返回的是temp2?)
               return temp2;
}

//拷贝构造函数是怎么样的?()