|
|
38ab4d |
From e7626f7aa1e5947f8235728fed5af862b27a719e Mon Sep 17 00:00:00 2001
|
|
|
5fb29d |
From: Peter Jones <pjones@redhat.com>
|
|
|
5fb29d |
Date: Wed, 10 Sep 2014 16:15:27 -0400
|
|
|
38ab4d |
Subject: [PATCH 12/31] Don't free something that shouldn't ever be non-NULL.
|
|
|
5fb29d |
|
|
|
5fb29d |
Instead, check and error if it's non-NULL.
|
|
|
5fb29d |
|
|
|
5fb29d |
(Covscan, which got this completely wrong.)
|
|
|
5fb29d |
|
|
|
5fb29d |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
5fb29d |
---
|
|
|
5fb29d |
src/lib/efi.c | 8 ++------
|
|
|
5fb29d |
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
5fb29d |
|
|
|
5fb29d |
diff --git a/src/lib/efi.c b/src/lib/efi.c
|
|
|
5fb29d |
index a131abe..f604a1a 100644
|
|
|
5fb29d |
--- a/src/lib/efi.c
|
|
|
5fb29d |
+++ b/src/lib/efi.c
|
|
|
5fb29d |
@@ -792,7 +792,7 @@ append_extra_args_ascii(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
int i;
|
|
|
5fb29d |
unsigned long usedchars=0;
|
|
|
5fb29d |
|
|
|
5fb29d |
- if (!data)
|
|
|
5fb29d |
+ if (!data || *data)
|
|
|
5fb29d |
return -1;
|
|
|
5fb29d |
|
|
|
5fb29d |
for (i=opts.optind; i < opts.argc; i++) {
|
|
|
5fb29d |
@@ -816,8 +816,6 @@ append_extra_args_ascii(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
if (!new_data)
|
|
|
5fb29d |
return 0;
|
|
|
5fb29d |
|
|
|
5fb29d |
- if (*data)
|
|
|
5fb29d |
- free(*data);
|
|
|
5fb29d |
*data = (uint8_t *)new_data;
|
|
|
5fb29d |
*data_size = usedchars;
|
|
|
5fb29d |
|
|
|
5fb29d |
@@ -831,7 +829,7 @@ append_extra_args_unicode(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
int i;
|
|
|
5fb29d |
unsigned long usedchars=0;
|
|
|
5fb29d |
|
|
|
5fb29d |
- if (!data)
|
|
|
5fb29d |
+ if (!data || *data)
|
|
|
5fb29d |
return -1;
|
|
|
5fb29d |
|
|
|
5fb29d |
for (i = opts.optind; i < opts.argc; i++) {
|
|
|
5fb29d |
@@ -857,8 +855,6 @@ append_extra_args_unicode(uint8_t **data, size_t *data_size)
|
|
|
5fb29d |
if (!new_data)
|
|
|
5fb29d |
return 0;
|
|
|
5fb29d |
|
|
|
5fb29d |
- if (*data)
|
|
|
5fb29d |
- free(*data);
|
|
|
5fb29d |
*data = (uint8_t *)new_data;
|
|
|
5fb29d |
*data_size = usedchars * sizeof (*new_data);
|
|
|
5fb29d |
|
|
|
5fb29d |
--
|
|
|
38ab4d |
2.7.4
|
|
|
5fb29d |
|