Add missing checks of return result of open() and gp_camera_file_get()
Coverity CID 1034362
(cherry picked from commit f9aa611556212eaa946ffbe53eadf36f3579f694)
Revert "Fix use after free: var->toString(i).c_str()"

This reverts commit 362914146a252c77d4184677efcab90bae40664f.
Revert "Fix another use after free"

This reverts commit a0e146a77cad5dd914115033fa3e41ca4c43564c.