tdf#120703 PVS: fix cleanup checks

pofs is guaranteed to be non-nullptr after getOutputStream, so no need
to check that. is_open() only matters to decide if close() is needed.

V595 The 'pofs' pointer was utilized before it was verified against nullptr.
     Check lines: 1033, 1057.
     Check lines: 1194, 1220.

Change-Id: I2dd22d29c465889269f2496f0964bee030cb5964
Reviewed-on: https://gerrit.libreoffice.org/71456
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index c1fec78..2d0eb0d 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -1034,18 +1034,19 @@
            *pofs << (nm > 0 ? "// closing namespace\n\n" : "\n");
        }

        if ( !standardout && pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
            static_cast<std::ofstream*>(pofs)->close();
        if (!standardout)
        {
            if (static_cast<std::ofstream*>(pofs)->is_open())
                static_cast<std::ofstream*>(pofs)->close();
            delete pofs;
            OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, false));
        }
    } catch (CannotDumpException & e) {
        std::cerr << "ERROR: " << e.getMessage() << "\n";
        if ( !standardout ) {
            if (pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
            if (static_cast<std::ofstream*>(pofs)->is_open())
                static_cast<std::ofstream*>(pofs)->close();
                delete pofs;
            }
            delete pofs;
            // remove existing type file if something goes wrong to ensure
            // consistency
            if (fileExists(compFileName))
@@ -1193,18 +1194,19 @@

        generateCompFunctions(*pofs, nmspace);

        if ( !standardout && pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
            static_cast<std::ofstream*>(pofs)->close();
        if (!standardout)
        {
            if (static_cast<std::ofstream*>(pofs)->is_open())
                static_cast<std::ofstream*>(pofs)->close();
            delete pofs;
            OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, false));
        }
    } catch (CannotDumpException & e) {
        std::cerr << "ERROR: " << e.getMessage() << "\n";
        if ( !standardout ) {
            if (pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
            if (static_cast<std::ofstream*>(pofs)->is_open())
                static_cast<std::ofstream*>(pofs)->close();
                delete pofs;
            }
            delete pofs;
            // remove existing type file if something goes wrong to ensure
            // consistency
            if (fileExists(compFileName))