[Libreoffice-commits] core.git: shell/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 22 20:59:29 UTC 2019


 shell/source/backends/kf5be/kf5backend.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ff398785bede2b403f8f8e6391ce07538f6cc213
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Thu Aug 22 19:09:46 2019 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Aug 22 22:58:41 2019 +0200

    kf5backend.cxx: Use 'free()' instead of 'delete'
    
    'strdup' doc [1] mentions:
    "The returned pointer must be passed to 'free' to avoid a memory leak."
    
    This silences a "Mismatched free() / delete / delete []" error that
    valgrind outputs.
    
    [1] https://en.cppreference.com/w/c/experimental/dynamic/strdup
    
    Change-Id: I28877be762256a7b995c09415a8ad9977b7998c4
    Reviewed-on: https://gerrit.libreoffice.org/77974
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx
index a2cae6c6c4fd..f55a5150bd3f 100644
--- a/shell/source/backends/kf5be/kf5backend.cxx
+++ b/shell/source/backends/kf5be/kf5backend.cxx
@@ -190,7 +190,7 @@ void initQApp(std::map<OUString, css::beans::Optional<css::uno::Any>>& rSettings
     std::unique_ptr<QApplication> app(new QApplication(nFakeArgc, pFakeArgv));
     QObject::connect(app.get(), &QObject::destroyed, app.get(), [nFakeArgc, pFakeArgv]() {
         for (int i = 0; i < nFakeArgc; ++i)
-            delete pFakeArgv[i];
+            free(pFakeArgv[i]);
         delete[] pFakeArgv;
     });
 


More information about the Libreoffice-commits mailing list