summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Trivedi <t.vivek@samsung.com>2015-12-11 10:58:01 -0500
committerSteve Dickson <steved@redhat.com>2015-12-11 11:22:25 -0500
commit9c3d8687c96b7fe4a7920dc474e91f190b6d8f37 (patch)
tree096545e64b99a710f4279daf255994035a330fc1
parent6f7a1d75f948f8d914e63f4ba4a24c97225689dc (diff)
downloadnfs-utils-9c3d8687c96b7fe4a7920dc474e91f190b6d8f37.tar.gz
nfs-utils-9c3d8687c96b7fe4a7920dc474e91f190b6d8f37.tar.xz
nfs-utils-9c3d8687c96b7fe4a7920dc474e91f190b6d8f37.zip
mount.nfs: fix null pointer derefernce in nfs_parse_simple_hostname
In function nfs_parse_simple_hostname, hostname can be NULL, dereferncing it while passing it to free(*hostname) may result in segfault. Signed-off-by: Vivek Trivedi <t.vivek@samsung.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mount/parse_dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
index d64b83d..0d3bcb9 100644
--- a/utils/mount/parse_dev.c
+++ b/utils/mount/parse_dev.c
@@ -118,7 +118,8 @@ static int nfs_parse_simple_hostname(const char *dev,
if (pathname) {
*pathname = strndup(colon, path_len);
if (*pathname == NULL) {
- free(*hostname);
+ if (hostname)
+ free(*hostname);
return nfs_pdn_nomem_err();
}
}