[PATCH] shell32: Fix use of uninitialized variable in paste_pidls (Clang)

Alex Henrie alexhenrie24 at gmail.com
Tue Aug 3 23:03:48 CDT 2021


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/shell32/shlview_cmenu.c:1163:17: warning: variable 'psfhlpsrc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
            if (SUCCEEDED(hr))
                ^~~~~~~~~~~~~
include/winerror.h:74:25: note: expanded from macro 'SUCCEEDED'
                        ^~~~~~~~~~~~~~~~~~~~
dlls/shell32/shlview_cmenu.c:1175:16: note: uninitialized use occurs here
            if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
               ^~~~~~~~~
dlls/shell32/shlview_cmenu.c:1163:13: note: remove the 'if' if its condition is always true
            if (SUCCEEDED(hr))
            ^~~~~~~~~~~~~~~~~~
dlls/shell32/shlview_cmenu.c:1161:45: note: initialize the variable 'psfhlpsrc' to silence this warning
            ISFHelper *psfhlpdst, *psfhlpsrc;
                                            ^
                                             = NULL
---
 dlls/shell32/shlview_cmenu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index ef11957e921..ec54f6b82cd 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -1171,8 +1171,11 @@ static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
                 ISFHelper_DeleteItems(psfhlpsrc, 1, &pidl_item);
                 */
             }
-            if(psfhlpdst) ISFHelper_Release(psfhlpdst);
-            if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
+            if(psfhlpdst)
+            {
+                ISFHelper_Release(psfhlpdst);
+                if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
+            }
             IShellFolder_Release(psfFrom);
         }
         SHFree(pidl_dir);
-- 
2.32.0




More information about the wine-devel mailing list