Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/include/relastro.h
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/include/relastro.h	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/include/relastro.h	(revision 36616)
@@ -485,5 +485,5 @@
 int assign_images (FITS_DB *db, RegionHostTable *regionHosts);
 int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage);
-int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax);
+int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid);
 int calculate_host_image_bounds (RegionHostTable *regionHosts);
 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc);
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImagePosIO.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImagePosIO.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImagePosIO.c	(revision 36616)
@@ -120,4 +120,9 @@
   free (nFitAstrom);
   free (flags     );
+
+  gfits_free_header (&header);
+  gfits_free_matrix (&matrix);
+  gfits_free_header (&theader);
+  gfits_free_table  (&ftable);
 
   *nimage_pos = Nrow;
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MeanPosIO.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MeanPosIO.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MeanPosIO.c	(revision 36616)
@@ -76,4 +76,10 @@
   free (objID);
   free (catID);
+
+  // free FITS table pieces...
+  gfits_free_header (&header);
+  gfits_free_matrix (&matrix);
+  gfits_free_header (&theader);
+  gfits_free_table  (&ftable);
 
   *nmeanpos = Nrow;
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c	(revision 36616)
@@ -131,6 +131,9 @@
     RegionHostInfo *host = &regionHosts->hosts[i];
 
+    // image bounds are defined for a range centered on the image center thus, an image
+    // with center 0.5 will have chips bounds ranging from ~ -1.5 to +2.5 or so, while an
+    // image with center 359.5 will have chips bounds ranging from ~ 357.5 to 361.5 or so
     double Rmin, Rmax, Dmin, Dmax;
-    calculate_image_bounds (&image[j], &Rmin, &Rmax, &Dmin, &Dmax);
+    calculate_image_bounds (&image[j], &Rmin, &Rmax, &Dmin, &Dmax, Rc);
 
     host->RminCat = MIN(Rmin, host->RminCat);
@@ -165,5 +168,5 @@
 double Yf[] = {0.0, 0.0, 1.0, 1.0};
 
-int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax) {
+int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid) {
 
   int n;
@@ -180,5 +183,5 @@
     Yc = Yf[n]*image->NY;
     XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords);
-    Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
+    Rc = ohana_normalize_angle_to_midpoint (Rc, Rmid);
       
     Rmin = MIN (Rmin, Rc);
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_images_pos.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_images_pos.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_images_pos.c	(revision 36616)
@@ -31,4 +31,5 @@
   char *iposfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "imagepos.fits");
   ImagePosSave (iposfile, image_pos, Nimage_pos);
+  free (image_pos);
   free (iposfile);
 
@@ -80,4 +81,5 @@
     images[seq].flags      = image_pos[i].flags     ;
   }
+  free (image_pos);
 
   fprintf (stderr, "DONE grabbing image mags from other hosts\n");
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_mean_pos.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_mean_pos.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_mean_pos.c	(revision 36616)
@@ -46,4 +46,5 @@
   char *posfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "meanpos.fits");
   MeanPosSave (posfile, meanpos, Nmeanpos);
+  free (meanpos);
   free (posfile);
 
@@ -97,4 +98,5 @@
     catalog[catSeq].average[objSeq].D = meanpos[i].D;
   }
+  free (meanpos);
 
   fprintf (stderr, "DONE grabbing mean object pos from other hosts...\n");
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MeanMagIO.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MeanMagIO.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MeanMagIO.c	(revision 36616)
@@ -82,4 +82,6 @@
   free (objID);
   free (catID);
+
+  // free FITS table pieces...
 
   *nmeanmags = Nrow;
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c	(revision 36616)
@@ -36,5 +36,5 @@
 
   // once we have read this table, we should remove it for repeat runs
-  unlink (IMAGE_TABLE); // XXX a bit risky, add some protection?
+  // unlink (IMAGE_TABLE); // XXX a bit risky, add some protection?
 
   // XXX need to deal with mosaic vs image...
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_image_mags.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_image_mags.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_image_mags.c	(revision 36616)
@@ -31,4 +31,5 @@
   char *imagfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "imagemags.fits");
   ImageMagSave (imagfile, image_mags, Nimage_mags);
+  free (image_mags);
   free (imagfile);
 
@@ -81,4 +82,5 @@
     images[seq].ubercalDist = image_mags[i].ubercalDist;
   }
+  free (image_mags);
 
   fprintf (stderr, "DONE grabbing image mags from other hosts\n");
Index: /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_mean_mags.c
===================================================================
--- /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_mean_mags.c	(revision 36615)
+++ /branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_mean_mags.c	(revision 36616)
@@ -53,4 +53,5 @@
   char *magsfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "meanmags.fits");
   MeanMagSave (magsfile, meanmags, Nmeanmags);
+  free (meanmags);
   free (magsfile);
 
@@ -111,4 +112,5 @@
     catalog[catSeq].secfilt[objSeq*Nsecfilt + Nsec].M = meanmags[i].M;
   }
+  free (meanmags);
 
   fprintf (stderr, "DONE grabbing mean object mags from other hosts...\n");
