diff --git a/src/common/file_posix.c b/src/common/file_posix.c
index acacf90736ea2ab6b4362ee1ce78fae6e23a6989..f887244efc4c4d52fcfcea1717c8fd934d949204 100644
--- a/src/common/file_posix.c
+++ b/src/common/file_posix.c
@@ -203,6 +203,7 @@ device_dax_alignment(const char *path)
 	}
 
 end:
+	pmem2_source_delete(&src);
 	os_close(fd);
 	return size;
 }
diff --git a/src/libpmem2/region_namespace_ndctl.c b/src/libpmem2/region_namespace_ndctl.c
index d503c62f53cd597e77cc30755b40518df0f94015..1383796a95cc7cbb2fb2b09f621d81fab40a76d4 100644
--- a/src/libpmem2/region_namespace_ndctl.c
+++ b/src/libpmem2/region_namespace_ndctl.c
@@ -140,8 +140,8 @@ pmem2_region_namespace(struct ndctl_ctx *ctx,
 	struct ndctl_region *region;
 	struct ndctl_namespace *ndns;
 
-	ASSERTne(pregion, NULL);
-	*pregion = NULL;
+	if (pregion)
+		*pregion = NULL;
 
 	if (pndns)
 		*pndns = NULL;
@@ -177,7 +177,8 @@ pmem2_region_namespace(struct ndctl_ctx *ctx,
 					return ret;
 
 				if (ret == 0) {
-					*pregion = region;
+					if (pregion)
+						*pregion = region;
 					if (pndns)
 						*pndns = ndns;
 
@@ -204,7 +205,8 @@ pmem2_region_namespace(struct ndctl_ctx *ctx,
 				return ret;
 
 			if (ret == 0) {
-				*pregion = region;
+				if (pregion)
+					*pregion = region;
 				if (pndns)
 					*pndns = ndns;