diff options
author | Toomas Soome <tsoome@FreeBSD.org> | 2020-03-28 21:50:27 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2021-10-08 02:42:32 +0000 |
commit | 3f92fa796181e754ca930e3e5f8a84db25b9d432 (patch) | |
tree | 01e770de637826597df28a67d36dd710a03b722e | |
parent | 7b47621aac4db952d9ec239114d3eec2fe53c5c8 (diff) | |
download | src-3f92fa796181e754ca930e3e5f8a84db25b9d432.tar.gz src-3f92fa796181e754ca930e3e5f8a84db25b9d432.zip |
loader: strdup name strings from dataset walker
The removal of zfs scratch buffer did miss the fact the dataset
lookup was picking up the names from zap list.
(cherry picked from commit 215597f05fc6cf9e218d26ef37063ec58451a259)
-rw-r--r-- | stand/libsa/zfs/zfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c index f54e68de578c..9bcf4b35a84e 100644 --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -92,7 +92,7 @@ static int zfs_env_count; SLIST_HEAD(zfs_be_list, zfs_be_entry) zfs_be_head = SLIST_HEAD_INITIALIZER(zfs_be_head); struct zfs_be_list *zfs_be_headp; struct zfs_be_entry { - const char *name; + cha *name; SLIST_ENTRY(zfs_be_entry) entries; } *zfs_be, *zfs_be_tmp; @@ -920,6 +920,7 @@ zfs_bootenv_initial(const char *name) while (!SLIST_EMPTY(&zfs_be_head)) { zfs_be = SLIST_FIRST(&zfs_be_head); SLIST_REMOVE_HEAD(&zfs_be_head, entries); + free(zfs_be->name); free(zfs_be); } @@ -987,6 +988,7 @@ zfs_bootenv(const char *name) while (!SLIST_EMPTY(&zfs_be_head)) { zfs_be = SLIST_FIRST(&zfs_be_head); SLIST_REMOVE_HEAD(&zfs_be_head, entries); + free(zfs_be->name); free(zfs_be); } @@ -1006,7 +1008,11 @@ zfs_belist_add(const char *name, uint64_t value __unused) if (zfs_be == NULL) { return (ENOMEM); } - zfs_be->name = name; + zfs_be->name = strdup(name); + if (zfs_be->name == NULL) { + free(zfs_be); + return (ENOMEM); + } SLIST_INSERT_HEAD(&zfs_be_head, zfs_be, entries); zfs_env_count++; |