opencv_trail_effect.cpp: fix potential leak when exiting during option parsing
authorAntonio Ospite <ao2@ao2.it>
Sat, 10 Oct 2020 17:38:10 +0000 (19:38 +0200)
committerAntonio Ospite <ao2@ao2.it>
Sat, 10 Oct 2020 17:38:10 +0000 (19:38 +0200)
commit21adbf9205a5c28a036ddd2373d85a9662e9b7fc
tree4f71c84fadb39cb7ee6daccd4630a497dc5efc75
parentf8ca8a0d90f171f64cc1d430148c9e8429e61dcb
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.
opencv_trail_effect.cpp