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:
parent
3fcdc9f7d5
commit
0c3f38b81b
@ -373,7 +373,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
|
|||||||
DBG("%s: %s\n", __func__, entry.d_name);
|
DBG("%s: %s\n", __func__, entry.d_name);
|
||||||
|
|
||||||
*list = list_append(*list, name);
|
*list = list_append(*list, name);
|
||||||
if (!list) {
|
if (!*list) {
|
||||||
SET_ERROR(ret, SP_ERR_MEM, "List append failed");
|
SET_ERROR(ret, SP_ERR_MEM, "List append failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
2
linux.c
2
linux.c
@ -236,7 +236,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
|
|||||||
}
|
}
|
||||||
DEBUG_FMT("Found port %s", name);
|
DEBUG_FMT("Found port %s", name);
|
||||||
*list = list_append(*list, name);
|
*list = list_append(*list, name);
|
||||||
if (!list) {
|
if (!*list) {
|
||||||
SET_ERROR(ret, SP_ERR_MEM, "List append failed");
|
SET_ERROR(ret, SP_ERR_MEM, "List append failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user