fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31939 )
Change subject: fix bs11_read_swl_file(): properly clean up stale file list ......................................................................
fix bs11_read_swl_file(): properly clean up stale file list
Calling talloc_free() on struct llist_head is wrong and will lead to unexpected behavior. Call it on the containing struct instead.
Change-Id: Ib5eaa328aaf6881ae9621ca14859e4e255af2b00 --- M src/osmo-bsc/abis_nm.c 1 file changed, 15 insertions(+), 5 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c index 938f45d..95cb858 100644 --- a/src/osmo-bsc/abis_nm.c +++ b/src/osmo-bsc/abis_nm.c @@ -2645,8 +2645,8 @@
static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw) { + struct file_list_entry *fle; char linebuf[255]; - struct llist_head *lh, *lh2; FILE *swl; int rc = 0;
@@ -2655,10 +2655,8 @@ return -ENODEV;
/* zero the stale file list, if any */ - llist_for_each_safe(lh, lh2, &bs11_sw->file_list) { - llist_del(lh); - talloc_free(lh); - } + while ((fle = fl_dequeue(&bs11_sw->file_list))) + talloc_free(fle);
while (fgets(linebuf, sizeof(linebuf), swl)) { char file_id[12+1];