Bug 93589

Summary: avoid redundant NULL check for 'to_close'
Product: p11-glue Reporter: Pankaj <pankaj.s01>
Component: p11-kitAssignee: Stef Walter <stefw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: proxy patch

Description Pankaj 2016-01-05 10:29:12 UTC
Created attachment 120810 [details]
proxy patch

Hi,
there is already checked for NULL at line
p11-kit/proxy.c:641 after memory allocation .So doesn't required to check inside while loop.
the respective patch has been attached ,please review it.
========================================================
diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c
index c554511..994f2f1 100644
--- a/p11-kit/proxy.c
+++ b/p11-kit/proxy.c
@@ -644,7 +644,7 @@ proxy_C_CloseAllSessions (CK_X_FUNCTION_LIST *self,
                                p11_dict_iterate (state->px->sessions, &iter);
                                count = 0;
                                while (p11_dict_next (&iter, NULL, (void**)&sess)) {
-                                       if (sess->wrap_slot == id && to_close)
+                                       if (sess->wrap_slot == id)
                                                to_close[count++] = sess->wrap_session;
                                }
                        }


-----------------------------------------------------
Thanks !
Pankaj Sharma

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.