Since you are dealing with raw pointers here, you must do the proper resource management. In this case, there is a possibility that it new Bitmap(...)can quit, for example, if the process runs out of memory, and it does not change the value of what pb indicates, since an exception will be thrown before the assignment is made.
, Bitmap , new , , .
, pb, new Bitmap... , .
, , , , .