Commit 1ccd64e1 authored by Roman Donchenko's avatar Roman Donchenko Committed by Alexander Smorkalov

Fix uninitialized memory reads and memory leaks in StereoGC

(cherry picked from commit 7d8e5f62)
parent 23bf3e33
...@@ -157,7 +157,10 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan ...@@ -157,7 +157,10 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
v->t = v->weight < 0; v->t = v->weight < 0;
} }
else else
{
v->next = NULL;
v->parent = 0; v->parent = 0;
}
} }
first = first->next; first = first->next;
...@@ -396,6 +399,8 @@ void cvReleaseStereoGCState( CvStereoGCState** _state ) ...@@ -396,6 +399,8 @@ void cvReleaseStereoGCState( CvStereoGCState** _state )
cvReleaseMat( &state->right ); cvReleaseMat( &state->right );
cvReleaseMat( &state->ptrLeft ); cvReleaseMat( &state->ptrLeft );
cvReleaseMat( &state->ptrRight ); cvReleaseMat( &state->ptrRight );
cvReleaseMat( &state->dispLeft );
cvReleaseMat( &state->dispRight );
cvReleaseMat( &state->vtxBuf ); cvReleaseMat( &state->vtxBuf );
cvReleaseMat( &state->edgeBuf ); cvReleaseMat( &state->edgeBuf );
cvFree( _state ); cvFree( _state );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment