Use template for nullify to avoid aliasing issue.
[gssweb.git] / json_gssapi / test / command_mocks / InitSecContextMock.h
index f26a2c5..e97dfb3 100644 (file)
@@ -33,17 +33,13 @@ public:
   static bool                   visited;
   static bool                   invalidContextHandle;
   
-  static void nullify(void **ptr)
+  template <class t>
+    static void nullify(t *&ptr)
   {
-    if (!ptr)
+    if (ptr)
     {
-      std::cout << std::endl << "Nullify called with a void ** that is NULL at the top level" << std::endl;
-      return;
-    }
-    if (*ptr)
-    {
-      free(*ptr);
-      *ptr = NULL;
+      free(ptr);
+      ptr = NULL;
     }
   }