Blame SOURCES/0260-Don-t-duplicate-net-name-string-if-not-needed.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Javier Martinez Canillas <javierm@redhat.com>
8631a2
Date: Thu, 25 Apr 2019 17:50:23 +0200
8631a2
Subject: [PATCH] Don't duplicate net->name string if not needed
8631a2
8631a2
Related: rhbz#1490991
8631a2
8631a2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8631a2
---
8631a2
 grub-core/net/efi/http.c | 18 +++++++++---------
8631a2
 1 file changed, 9 insertions(+), 9 deletions(-)
8631a2
8631a2
diff --git a/grub-core/net/efi/http.c b/grub-core/net/efi/http.c
8631a2
index 484e0c68cee..de351b2cd03 100644
8631a2
--- a/grub-core/net/efi/http.c
8631a2
+++ b/grub-core/net/efi/http.c
8631a2
@@ -394,27 +394,27 @@ grub_efihttp_open (struct grub_efi_net_device *dev,
8631a2
   grub_err_t err;
8631a2
   grub_off_t size;
8631a2
   char *buf;
8631a2
-  char *file_name;
8631a2
+  char *file_name = NULL;
8631a2
   const char *http_path;
8631a2
 
8631a2
   /* If path is relative, prepend http_path */
8631a2
   http_path = grub_env_get ("http_path");
8631a2
-  if (http_path && file->device->net->name[0] != '/')
8631a2
+  if (http_path && file->device->net->name[0] != '/') {
8631a2
     file_name = grub_xasprintf ("%s/%s", http_path, file->device->net->name);
8631a2
-  else
8631a2
-    file_name = grub_strdup (file->device->net->name);
8631a2
+    if (!file_name)
8631a2
+      return grub_errno;
8631a2
+  }
8631a2
 
8631a2
-  if (!file_name)
8631a2
-    return grub_errno;
8631a2
-
8631a2
-  err = efihttp_request (dev->http, file->device->net->server, file_name, type, 1, 0);
8631a2
+  err = efihttp_request (dev->http, file->device->net->server,
8631a2
+			 file_name ? file_name : file->device->net->name, type, 1, 0);
8631a2
   if (err != GRUB_ERR_NONE)
8631a2
     {
8631a2
       grub_free (file_name);
8631a2
       return err;
8631a2
     }
8631a2
 
8631a2
-  err = efihttp_request (dev->http, file->device->net->server, file_name, type, 0, &size);
8631a2
+  err = efihttp_request (dev->http, file->device->net->server,
8631a2
+			 file_name ? file_name : file->device->net->name, type, 0, &size);
8631a2
   grub_free (file_name);
8631a2
   if (err != GRUB_ERR_NONE)
8631a2
     {