cvReleaseImage with cvqueryframe
===

I'm grabbing a frame from an avi video. 

    img1 = cvQueryFrame( capture );   
    cvReleaseImage( &img1 );
   

 When I try to release the grabbed frame img1, I get 

    "An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in "

How can I release the memory allocated for img1?