cppcheck: fix possible null deref and unused structs
[m6w6/ext-psi] / src / libffi.c
index e2dc81fe2f722998e18c5d3964f5abadd1cd74d5..8cf29ddbd7dc445c29b302e6fbc1c48cab1d47b2 100644 (file)
@@ -1,5 +1,7 @@
 #ifdef HAVE_CONFIG_H
 # include "config.h"
+#else
+# include "php_config.h"
 #endif
 
 #include "php.h"
@@ -447,12 +449,12 @@ static zend_function_entry *psi_ffi_compile(struct psi_context *C)
                if (!impl->decl) {
                        continue;
                }
-
-               if ((call = psi_ffi_call_alloc(C, impl->decl))) {
-                       if (FFI_OK != psi_ffi_call_init_closure(C, call, impl)) {
-                               psi_ffi_call_free(call);
-                               continue;
-                       }
+               if (!(call = psi_ffi_call_alloc(C, impl->decl))) {
+                       continue;
+               }
+               if (FFI_OK != psi_ffi_call_init_closure(C, call, impl)) {
+                       psi_ffi_call_free(call);
+                       continue;
                }
 
                zf->fname = impl->func->name + (impl->func->name[0] == '\\');