[PATCH 1/8] openvpn: Fix use of NULL private data.

Jussi Laakkonen <[email protected]> Thu, 10 Apr 2025 18:58:39 +0300
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
Found with Clang analyzer.
---
 vpn/plugins/openvpn.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vpn/plugins/openvpn.c b/vpn/plugins/openvpn.c
index 6e288efe..b213bd86 100644
--- a/vpn/plugins/openvpn.c
+++ b/vpn/plugins/openvpn.c
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2010-2014  BMW Car IT GmbH.
  *  Copyright (C) 2016-2019  Jolla Ltd.
+ *  Copyright (C) 2025  Jolla Mobile Ltd
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -117,7 +118,10 @@ struct ov_private_data {

 static void ov_connect_done(struct ov_private_data *data, int err)
 {
-	if (data && data->cb) {
+	if (!data)
+		return;
+
+	if (data->cb) {
 		vpn_provider_connect_cb_t cb = data->cb;
 		void *user_data = data->user_data;

--
2.39.5