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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Leon Romanovsky <leonro@xxxxxxxxxxxx>

Fixes: 74bd75c2b68d ("rdma: Add basic infrastructure for RDMA tool")
Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux