lkml.org 
[lkml]   [2018]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 5/9] um/drivers/vector_user: Delete two unnecessary checks before freeaddrinfo() in user_init_socket_fds()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 11 Mar 2018 14:20:46 +0100

The implementation returns from this function if a null pointer
was detected in the local variable "gairesult". Thus the check
before two calls of the function "freeaddrinfo" is not needed.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/um/drivers/vector_user.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/um/drivers/vector_user.c b/arch/um/drivers/vector_user.c
index e831bd85cad4..2dee1e183387 100644
--- a/arch/um/drivers/vector_user.c
+++ b/arch/um/drivers/vector_user.c
@@ -384,9 +384,7 @@ static struct vector_fds *user_init_socket_fds(struct arglist *ifspec, int id)
goto cleanup;
}

- if (gairesult != NULL)
- freeaddrinfo(gairesult);
-
+ freeaddrinfo(gairesult);
gairesult = NULL;

gairet = getaddrinfo(dst, dstport, &dsthints, &gairesult);
@@ -416,8 +414,7 @@ static struct vector_fds *user_init_socket_fds(struct arglist *ifspec, int id)
freeaddrinfo(gairesult);
return result;
cleanup:
- if (gairesult != NULL)
- freeaddrinfo(gairesult);
+ freeaddrinfo(gairesult);

if (fd >= 0)
os_close_file(fd);
--
2.16.2
\
 
 \ /
  Last update: 2018-03-11 16:21    [W:0.122 / U:4.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site