Patchwork [Open-FCoE,2/2] Print an error upon failure in memory allocation for struct pollfd

mail settings
Submitter Milan P. Gandhi
Date July 7, 2016, 10:09 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/331/
State New
Headers show


Milan P. Gandhi - July 7, 2016, 10:09 a.m.

In pfd_remove function, if the memory could not be allocated 
for polling request struct pollfd *npfd, then there is 
no error printed. This patch will print an error if memory
allocation fails for struct pollfd *npfd. This is just to 
improve error reporting upon memory allocation failure, 
similar to pfd_add function.

Signed-off-by: Milan P. Gandhi <>


diff --git a/fipvlan.c b/fipvlan.c
index 2059276..493f7fa 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -124,6 +124,8 @@  static void pfd_remove(int fd)
 	npfd = realloc(pfd, pfd_len * sizeof(struct pollfd));
 	if (npfd)
 		pfd = npfd;
+	else
+		perror("realloc fail");
fcoe-devel mailing list