Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dangling pointer for logging file #291

Merged
merged 1 commit into from May 16, 2020

Commits on May 16, 2020

  1. Fix dangling pointer for logging file

    標準出力をログファイルにリダイレクトさせる処理の中で一時変数の文字列
    からポインターを使っている、つまりダングリングポインターになっていると
    cppcheckに警告されたため修正します。
    
    cppcheckのレポート
    ```
    src/main.cpp:505:24: error: Using pointer to temporary. [danglingTemporaryLifetime]
            tmp = freopen( logfile, "ab", stdout );
                           ^
    src/main.cpp:504:31: note: Pointer to container is created here.
            const char *logfile = to_locale_cstr( CACHE::path_msglog() );
                                  ^
    src/main.cpp:505:24: note: Using pointer to temporary.
            tmp = freopen( logfile, "ab", stdout );
                           ^
    src/main.cpp:507:24: error: Using pointer to temporary. [danglingTemporaryLifetime]
            tmp = freopen( logfile, "ab", stderr );
                           ^
    src/main.cpp:504:31: note: Pointer to container is created here.
            const char *logfile = to_locale_cstr( CACHE::path_msglog() );
                                  ^
    src/main.cpp:507:24: note: Using pointer to temporary.
            tmp = freopen( logfile, "ab", stderr );
                           ^
    ```
    ma8ma committed May 16, 2020
    Configuration menu
    Copy the full SHA
    7a84006 View commit details
    Browse the repository at this point in the history