+
+/*
+ * Free and reset our component hash table
+ */
+
+static void
+free_comptable(void)
+{
+ int i;
+ struct comp *cm, *cm2;
+
+ for (i = 0; i < sizeof(wantcomp)/sizeof(wantcomp[0]); i++) {
+ cm = wantcomp[i];
+ while (cm != NULL) {
+ cm2 = cm->c_next;
+ free_component(cm);
+ cm = cm2;
+ }
+ wantcomp[i] = 0;
+ }
+}
+
+/*
+ * Decrement the reference count of a component structure. If it reaches
+ * zero, free it
+ */
+
+static void
+free_component(struct comp *cm)
+{
+ if (--cm->c_refcount <= 0) {
+ free(cm);
+ }
+}