[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 2 commits - vcl/unx

Mark Wielaard mark at klomp.org
Wed Jun 5 02:10:51 PDT 2013


 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |    4 +++-
 vcl/unx/gtk/fpicker/SalGtkPicker.cxx     |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit ac792ca91c109232dc34e1cf4f7663364ad04bd4
Author: Mark Wielaard <mark at klomp.org>
Date:   Tue Jun 4 21:52:33 2013 +0200

    Fix memory leak in SalGtkPicker::uritounicode.
    
    The gchars array returned by g_filename_from_uri will be copied into
    the OUString sEncoded and should be freed.
    
    Change-Id: Ib610cce5848607826632c0f5e32020708dac7645
    Reviewed-on: https://gerrit.libreoffice.org/4156
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>
    (cherry picked from commit 26c4f64a7f7f72e40a3ff1e76eb95a538d1c56db)

diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
index d14c00b..ed976d7 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
@@ -60,6 +60,7 @@ OUString SalGtkPicker::uritounicode(const gchar* pIn)
         {
             OUString sEncoded(pEncodedFileName, strlen(pEncodedFileName),
                 osl_getThreadTextEncoding());
+            g_free (pEncodedFileName);
             INetURLObject aCurrentURL(sEncoded, INetURLObject::FSYS_UNX);
             aCurrentURL.SetHost(aURL.GetHost());
             sURL = aCurrentURL.getExternalURL();
commit 2d8d546a64b8cdde50dcd0d203abe9bce2451f14
Author: Mark Wielaard <mark at klomp.org>
Date:   Tue Jun 4 22:02:39 2013 +0200

    Fix memory leak in SalGtkFilePicker::execute.
    
    The result of g_filename_from_uri should be explicitly freed when done.
    
    Change-Id: I194a562482531aa51cf31ed1f7dbc0ee59054d8b
    Reviewed-on: https://gerrit.libreoffice.org/4158
    Reviewed-by: Noel Power <noel.power at suse.com>
    Tested-by: Noel Power <noel.power at suse.com>
    (cherry picked from commit 32345f9963dd2900da174d9c7dec6a070fce8f9c)

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 102e16e..88cb3de 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -986,7 +986,8 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                     if( aPathSeq.getLength() == 1 )
                     {
                         OString sFileName = unicodetouri( aPathSeq[0] );
-                        if( g_file_test( g_filename_from_uri( sFileName.getStr(), NULL, NULL ), G_FILE_TEST_IS_REGULAR ) )
+                        gchar *gFileName = g_filename_from_uri ( sFileName.getStr(), NULL, NULL );
+                        if( g_file_test( gFileName, G_FILE_TEST_IS_REGULAR ) )
                         {
                             GtkWidget *dlg;
                             INetURLObject aFileObj( sFileName );
@@ -1033,6 +1034,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
 
                             gtk_widget_destroy( dlg );
                         }
+                        g_free (gFileName);
 
                         if( btn == GTK_RESPONSE_YES )
                             retVal = ExecutableDialogResults::OK;


More information about the Libreoffice-commits mailing list