This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 720bbea6b2 Coverity 1508984: Dereference null return value (#10245)
720bbea6b2 is described below

commit 720bbea6b2d3285cdb547a4016740a1b92be17a6
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Fri Aug 18 05:03:10 2023 +0900

    Coverity 1508984: Dereference null return value (#10245)
---
 tests/tools/plugins/async_engine.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/tools/plugins/async_engine.c 
b/tests/tools/plugins/async_engine.c
index b596b41805..4fb349ab37 100644
--- a/tests/tools/plugins/async_engine.c
+++ b/tests/tools/plugins/async_engine.c
@@ -73,10 +73,14 @@ EVP_PKEY *
 async_load_privkey(ENGINE *e, const char *s_key_id, UI_METHOD *ui_method, void 
*callback_data)
 {
   fprintf(stderr, "Loading key %s\n", s_key_id);
-  FILE *f       = fopen(s_key_id, "r");
-  EVP_PKEY *key = PEM_read_PrivateKey(f, NULL, NULL, NULL);
-  fclose(f);
-  return key;
+  FILE *f = fopen(s_key_id, "r");
+  if (f) {
+    EVP_PKEY *key = PEM_read_PrivateKey(f, NULL, NULL, NULL);
+    fclose(f);
+    return key;
+  } else {
+    return NULL;
+  }
 }
 
 static int

Reply via email to