Index: trunk/Ohana/src/opihi/dvo/ddmags.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/ddmags.c	(revision 7917)
+++ trunk/Ohana/src/opihi/dvo/ddmags.c	(revision 8427)
@@ -60,16 +60,13 @@
     /* lock, load, unlock catalog */
     catalog.filename = skylist[0].filename[k];
-    switch (lock_catalog (&catalog, LCK_SOFT)) {
-      case 2:
-	unlock_catalog (&catalog);
-      case 0:
-	continue;
+    catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
+
+    // an error exit status here is a significant error
+    if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {
+      fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename);
+      exit (2);
     }
-    catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF;
-    if (!load_catalog (&catalog, TRUE)) {
-      unlock_catalog (&catalog);
-      continue;
-    }
-    unlock_catalog (&catalog);
+    dvo_catalog_unlock (&catalog);
+
     // gprint (GP_ERR, "seaching %s with %d stars\n", catalog.filename, catalog.Naverage);
     // ListPhotSelections ();
@@ -113,11 +110,5 @@
     }
     // gprint (GP_ERR, "selected %d stars\n", Npts);
-
-    if (catalog.average != NULL) free (catalog.average);
-    if (catalog.secfilt != NULL) free (catalog.secfilt);
-    if (catalog.measure != NULL) free (catalog.measure);
-    catalog.average = (Average *) NULL; 
-    catalog.secfilt = (SecFilt *) NULL;
-    catalog.measure = (Measure *) NULL;
+    dvo_catalog_free (&catalog);
   }
   SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
@@ -130,7 +121,5 @@
 escape:
   SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
-  if (catalog.average != NULL) free (catalog.average);
-  if (catalog.secfilt != NULL) free (catalog.secfilt);
-  if (catalog.measure != NULL) free (catalog.measure);
+  dvo_catalog_free (&catalog);
   if (RegionName != NULL) free (RegionName);
   if (RegionList != NULL) free (RegionList);
