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

login
register
mail settings
Submitter Milan P. Gandhi
Date July 7, 2016, 10:09 a.m.
Message ID <196ef5db-2f36-8cac-91a6-f3f8b205bf59@redhat.com>
Download mbox | patch
Permalink /patch/331/
State New
Headers show

Comments

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

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 <mgandhi@redhat.com>
---

fcoe-devel@open-fcoe.org
http://lists.open-fcoe.org/mailman/listinfo/fcoe-devel

Patch

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