From: Antonio Ospite Date: Sat, 10 Oct 2020 17:38:10 +0000 (+0200) Subject: opencv_trail_effect.cpp: fix potential leak when exiting during option parsing X-Git-Url: https://git.ao2.it/experiments/opencv_trail_effect.git/commitdiff_plain/21adbf9205a5c28a036ddd2373d85a9662e9b7fc?ds=sidebyside;hp=21adbf9205a5c28a036ddd2373d85a9662e9b7fc opencv_trail_effect.cpp: fix potential leak when exiting during option parsing When bailing out during option parsingi, for example when '-h' or an invalid option is passed, some pointer to strings were not cleaned up, leading to a potential leak, as reported by scan-build: ----------------------------------------------------------------------- opencv_trail_effect.cpp:120:4: warning: Potential leak of memory pointed to by 'drawing_method' usage(argv[0]); ^~~~~ opencv_trail_effect.cpp:120:4: warning: Potential leak of memory pointed to by 'input_file' usage(argv[0]); ^~~~~ opencv_trail_effect.cpp:120:4: warning: Potential leak of memory pointed to by 'output_file' usage(argv[0]); ^~~~~ opencv_trail_effect.cpp:120:4: warning: Potential leak of memory pointed to by 'segmentation_method' usage(argv[0]); ^~~~~ opencv_trail_effect.cpp:123:4: warning: Potential leak of memory pointed to by 'drawing_method' usage(argv[0]); ^~~~~ opencv_trail_effect.cpp:123:4: warning: Potential leak of memory pointed to by 'segmentation_method' usage(argv[0]); ^~~~~ ----------------------------------------------------------------------- Stop using pointers to strings which really give no benefits in this case and avoid the issue altogether. ---