Subject: [PATCH iproute2-next v2 10/10] rdma: Check return value of strdup call

From: Leon Romanovsky <[email-masked]>
Date: Wed, 17 Jan 2018 12:02:32 +0200

From: Leon Romanovsky <[email-masked]>

Fixes: 74bd75c2b68d ("rdma: Add basic infrastructure for RDMA tool")
Signed-off-by: Leon Romanovsky <[email-masked]>
---
 rdma/utils.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/rdma/utils.c b/rdma/utils.c
index 059aa788..f9460162 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -98,6 +98,10 @@ static struct dev_map *dev_map_alloc(const char *dev_name)
 	if (!dev_map)
 		return NULL;
 	dev_map->dev_name = strdup(dev_name);
+	if (!dev_map->dev_name) {
+		free(dev_map);
+		return NULL;
+	}
 
 	return dev_map;
 }
-- 
2.15.1