We want to check here if we added something to the list, not if the function argument was valid. Problem spotted by Coverity, CID 50754.
Signed-off-by: Wolfram Sang <w...@the-dreams.de> --- freebsd.c | 2 +- linux.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/freebsd.c b/freebsd.c index b5cd91a..387b2f8 100644 --- a/freebsd.c +++ b/freebsd.c @@ -373,7 +373,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list) DBG("%s: %s\n", __func__, entry.d_name); *list = list_append(*list, name); - if (!list) { + if (!*list) { SET_ERROR(ret, SP_ERR_MEM, "List append failed"); break; } diff --git a/linux.c b/linux.c index 9016489..f7dc8fd 100644 --- a/linux.c +++ b/linux.c @@ -236,7 +236,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list) } DEBUG_FMT("Found port %s", name); *list = list_append(*list, name); - if (!list) { + if (!*list) { SET_ERROR(ret, SP_ERR_MEM, "List append failed"); break; } -- 2.7.0 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140 _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel