Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame^] | 1 | From 085f027e9e9f1478f68ddda705f83b244ee3bd88 Mon Sep 17 00:00:00 2001 |
| 2 | From: Robbie Harwood <rharwood@redhat.com> |
| 3 | Date: Mon, 18 Apr 2022 13:08:18 -0400 |
| 4 | Subject: [PATCH] Fix invalid free in main() |
| 5 | |
| 6 | data is allocated by mmap() in prepare_data(). |
| 7 | |
| 8 | Resolves: #173 |
| 9 | Signed-off-by: Robbie Harwood <rharwood@redhat.com> |
| 10 | Upstream-Status: Backport |
| 11 | Link: https://github.com/rhboot/efivar/commit/6be2cb1c0139ac177e754b0767abf1ca1533847f |
| 12 | Signed-off-by: Grygorii Tertychnyi <grygorii.tertychnyi@leica-geosystems.com> |
| 13 | |
| 14 | --- |
| 15 | src/efivar.c | 2 +- |
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 17 | |
| 18 | diff --git a/src/efivar.c b/src/efivar.c |
| 19 | index 5cd1eb2bc73c..09f85edd0a38 100644 |
| 20 | --- a/src/efivar.c |
| 21 | +++ b/src/efivar.c |
| 22 | @@ -633,7 +633,7 @@ int main(int argc, char *argv[]) |
| 23 | if (sz < 0) |
| 24 | err(1, "Could not import data from \"%s\"", infile); |
| 25 | |
| 26 | - free(data); |
| 27 | + munmap(data, data_size); |
| 28 | data = NULL; |
| 29 | data_size = 0; |
| 30 | |