qcacmn: Add NULL checks before dereferencing

Add NULL checks before dereferencing in:
1) HIF layer
2) WMI layer.

Change-Id: I47c5d18ae7841826d958d742283edb0bd6d246b7
CRs-Fixed: 1036390
diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c
index 10864c4..7751231 100644
--- a/wmi_unified_tlv.c
+++ b/wmi_unified_tlv.c
@@ -5887,6 +5887,11 @@
 	len = sizeof(*cmd);
 	buf = wmi_buf_alloc(wmi_handle, len);
 
+	if (!buf) {
+		WMI_LOGE("%s: buf allocation failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
 	buf_ptr = (uint8_t *) wmi_buf_data(buf);
 	qdf_mem_zero(buf_ptr, len);
 	cmd = (wmi_request_link_stats_cmd_fixed_param *) buf_ptr;