From: Markus Elfring <elfr...@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 <elfr...@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

Reply via email to