OSDN Git Service
(root)
/
android-x86
/
external-efibootmgr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5083099
)
Don't depend on vendor-defined calloc(n, 0) behavior.
author
Peter Jones
<pjones@redhat.com>
Mon, 12 Jan 2015 19:15:24 +0000
(14:15 -0500)
committer
Peter Jones
<pjones@redhat.com>
Mon, 12 Jan 2015 19:15:24 +0000
(14:15 -0500)
If we don't have any boot variables, we know that 0 is free, so just
return that.
Signed-off-by: Peter Jones <pjones@redhat.com>
src/efibootmgr/efibootmgr.c
patch
|
blob
|
history
diff --git
a/src/efibootmgr/efibootmgr.c
b/src/efibootmgr/efibootmgr.c
index
319e732
..
9f1636a
100644
(file)
--- a/
src/efibootmgr/efibootmgr.c
+++ b/
src/efibootmgr/efibootmgr.c
@@
-172,9
+172,13
@@
find_free_boot_var(list_t *boot_list)
uint16_t *vars, free_number;
list_t *pos;
var_entry_t *boot;
- list_for_each(pos, boot_list) {
+
+ list_for_each(pos, boot_list)
num_vars++;
- }
+
+ if (num_vars == 0)
+ return 0;
+
vars = calloc(1, sizeof(uint16_t) * num_vars);
if (!vars)
return -1;