platform: msm_shared: check if pub_key is NULL before using it.

The pointer pub_key returned from X59_get_pubkey() might be NULL,
which would lead crash here.

CRs-Fixed: 687723
Change-Id: Ib72e441bf3ba746fdf35391b02ad3d05de3f9848
diff --git a/platform/msm_shared/image_verify.c b/platform/msm_shared/image_verify.c
index 0d280f2..284f8e5 100644
--- a/platform/msm_shared/image_verify.c
+++ b/platform/msm_shared/image_verify.c
@@ -55,6 +55,11 @@
 		goto cleanup;
 	}
 	pub_key = X509_get_pubkey(x509_certificate);
+	if (pub_key == NULL) {
+		dprintf(CRITICAL, "ERROR: Boot Invalid, PUB_KEY is NULL!\n");
+		goto cleanup;
+	}
+
 	rsa_key = EVP_PKEY_get1_RSA(pub_key);
 	if (rsa_key == NULL) {
 		dprintf(CRITICAL, "ERROR: Boot Invalid, RSA_KEY is NULL!\n");