Fix coverity defects: CID 147511, 147513

CID 147511: Type:Dereference before null check
CID 147513: Type:Dereference before null check

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn>
Closes #5306
This commit is contained in:
cao 2016-10-25 04:37:38 +08:00 committed by Brian Behlendorf
parent 13d9a004fe
commit aed0e9f3e4
2 changed files with 5 additions and 3 deletions

View File

@ -3290,7 +3290,7 @@ zdb_vdev_lookup(vdev_t *vdev, char *path)
return (NULL);
vdev = vdev->vdev_child[i];
if (*s == '\0')
if (s && *s == '\0')
return (vdev);
return (zdb_vdev_lookup(vdev, s+1));

View File

@ -532,8 +532,10 @@ nfs_is_share_active(sa_share_impl_t impl_share)
nfs_exportfs_temp_fp = fdopen(fd, "r");
if (nfs_exportfs_temp_fp == NULL ||
fseek(nfs_exportfs_temp_fp, 0, SEEK_SET) < 0) {
if (nfs_exportfs_temp_fp == NULL)
return (B_FALSE);
if (fseek(nfs_exportfs_temp_fp, 0, SEEK_SET) < 0) {
fclose(nfs_exportfs_temp_fp);
return (B_FALSE);
}