jcs
/subtext
/amendments
/591
db: Free bile object in db_cache_boards
jcs made amendment 591 9 months ago
--- db.c Mon Feb 12 17:50:36 2024
+++ db.c Thu Feb 15 21:15:00 2024
@@ -649,8 +649,7 @@ db_cache_boards(struct db *tdb)
panic("getpath failed on %s", PtoCstr(tdb->bile->filename));
PtoCstr(db_filename);
- tdb->nboards = bile_sorted_ids_by_type(tdb->bile, DB_BOARD_RTYPE,
- &ids);
+ tdb->nboards = bile_sorted_ids_by_type(tdb->bile, DB_BOARD_RTYPE, &ids);
if (!tdb->nboards)
return;
tdb->boards = xcalloc(tdb->nboards, sizeof(struct board));
@@ -668,12 +667,12 @@ db_cache_boards(struct db *tdb)
if (obj == NULL)
break;
- size = bile_read_alloc(tdb->bile, DB_BOARD_RTYPE, obj->id,
- &data);
+ size = bile_read_alloc(tdb->bile, DB_BOARD_RTYPE, obj->id, &data);
bile_unmarshall_object(tdb->bile, board_object_fields,
nboard_object_fields, data, size, (char *)(&tdb->boards[n]),
sizeof(struct board), true);
xfree(&data);
+ xfree(&obj);
}
xfree(&ids);