[REVIEW] Null pointer passed as an argument to a 'nonnull' parameter in vcl/unx/generic/app/i18n_wrp.cxx

julien2412 serval2412 at yahoo.fr
Thu Feb 16 14:39:23 PST 2012


Hello,

By keeping on reading the logs cclang compilation, I noticed this :
/home/julien/compile-libreoffice/libo/vcl/unx/generic/app/i18n_wrp.cxx:250:9:
warning: Null pointer passed as an argument to a 'nonnull' parameter
        dlclose(g_dlmodule);
        ^       ~~~~~~~~~~
1 warning generated.
Here are the lines : 
    243 Status XvaCloseIM(XIM)
    244 {
    245       Status s = False;
    246 
    247     if (!g_dlmodule)  <<<<< CAUSE OF THE PB
    248     {
    249         /* assuming one XvaOpenIM call */
    250         dlclose(g_dlmodule); <<<<< HERE
    251             g_dlmodule = (void*)0;
    252         g_open_im = (OpenFunction)NULL;
    253         s = True;
    254       }
    255     return (s);
    256 }
So here's an obvious patch :
diff --git a/vcl/unx/generic/app/i18n_wrp.cxx
b/vcl/unx/generic/app/i18n_wrp.cxx
index 3aff25c..b95ad21 100644
--- a/vcl/unx/generic/app/i18n_wrp.cxx
+++ b/vcl/unx/generic/app/i18n_wrp.cxx
@@ -244,7 +244,7 @@ Status XvaCloseIM(XIM)
 {
       Status s = False;
 
-    if (!g_dlmodule)
+    if (g_dlmodule)
     {
         /* assuming one XvaOpenIM call */
         dlclose(g_dlmodule);

I suppose again it's ok to push this fix on master but would it be useful to
push this on 3.5 branch too ? 
Remark : when I opengroked this function , I found nothing. Is this function
used (or should be used) in a way ? 

Julien.

--
View this message in context: http://nabble.documentfoundation.org/REVIEW-Null-pointer-passed-as-an-argument-to-a-nonnull-parameter-in-vcl-unx-generic-app-i18n-wrp-cxx-tp3752158p3752158.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list