Destroying the off-screen bitmap buffer

Listing 5 is similar to the corresponding code in the previous program.

The difference is the call to the destroy_bitmap function in Listing 5.

Listing 5. Destroying the off-screen bitmap buffer.
  //Block and wait until the user presses a key.
  //Destroy bitmap to avoid memory leaks.

  return 0;//Return 0 to indicate a successful run....
}//end main function

The call to destroy_bitmap frees the memory currently occupied by the bitmap: