From 528256932b8586587c7b339418d3865206717b60 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sun, 10 Jan 2016 11:33:13 +0300 Subject: [PATCH] net: remove dead and redundant code server cannot be NULL at this point (we return error earlier if it is). Also structure is zalloc'ed, so no need to explicitly initialize members to 0. Found by: Coverity scan. CID: 73837 --- grub-core/net/net.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c index a0472d5d4..85b0cf774 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -1322,20 +1322,13 @@ grub_net_open_real (const char *name) if (!ret) return NULL; ret->protocol = proto; - if (server) + ret->server = grub_strdup (server); + if (!ret->server) { - ret->server = grub_strdup (server); - if (!ret->server) - { - grub_free (ret); - return NULL; - } + grub_free (ret); + return NULL; } - else - ret->server = NULL; ret->fs = &grub_net_fs; - ret->offset = 0; - ret->eof = 0; return ret; } }