+static void
+free_drives (struct drv *drv)
+{
+ if (!drv) return;
+ free_drives (drv->next);
+
+ switch (drv->type) {
+ case drv_a: /* a.filename and a.format are optargs, don't free them */ break;
+ case drv_d: /* d.filename is optarg, don't free it */ break;
+ case drv_N:
+ free (drv->N.filename);
+ free (drv->N.device);
+ free_prep_data (drv->N.data);
+ break;
+ default: ; /* keep GCC happy */
+ }
+ free (drv);
+}
+
+static void
+free_mps (struct mp *mp)
+{
+ if (!mp) return;
+ free_mps (mp->next);
+
+ /* The drive and mountpoint fields are not allocated
+ * from the heap, so we should not free them here.
+ */
+
+ free (mp);
+}
+