1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

linux: freebsd: do check on proper pointer

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 <wsa@the-dreams.de>
This commit is contained in:
Wolfram Sang 2016-02-19 22:25:00 +01:00 committed by Uwe Hermann
parent 3fcdc9f7d5
commit 0c3f38b81b
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}