fix potential string overrun and resource leakage thanks to Coverity Scan
fix potential string overrun and resource leakage thanks to Coverity Scan

johannjacobsohn/so2-camera,johannjacobsohn/so2-camera