aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-16 06:16:47 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-03-16 06:17:08 +0700
commitf18397aac9cc1785a9ea5cb89716cd874ede325b (patch)
treee1b0c5c8a55afd2049542bbe2ead6d03363b0d4b
parenta4fd6d937151c2f321533d20f78c052caa9b6bf1 (diff)
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
-rw-r--r--src/osmo-bsc/abis_nm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c
index 938f45d13..95cb85811 100644
--- a/src/osmo-bsc/abis_nm.c
+++ b/src/osmo-bsc/abis_nm.c
@@ -2645,8 +2645,8 @@ struct file_list_entry *fl_dequeue(struct llist_head *queue)
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 @@ static int bs11_read_swl_file(struct abis_nm_bs11_sw *bs11_sw)
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];