Hello everyone,

I decided to run cppcheck and clang static analyzer on sigrok-cli. It
passes static analysis just fine except one warning:

https://afiskon.ru/s/95/28e3562fdd_session.c.html

Proposed patch fixes this.

-- 
Best regards,
Aleksander Alekseev
diff --git a/session.c b/session.c
index 5d92362..c36aad7 100644
--- a/session.c
+++ b/session.c
@@ -580,6 +580,12 @@ void run_session(void)
 		}
 	}
 
+	/* This is unlikely to happen but it makes static analyzers stop complaining. */
+	if (!devices) {
+		g_critical("No real devices found.");
+		return;
+	}
+
 	sdi = devices->data;
 	g_slist_free(devices);
 	g_slist_free(real_devices);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to