fixed defects found by Coverity Scan
Merge pull request #2328 from Jiaolong/graph_cut

fixed defects found by Coverity Scan