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