Index: trunk/psModules/src/objects/pmSourceIO_Ghosts.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO_Ghosts.c	(revision 41391)
+++ trunk/psModules/src/objects/pmSourceIO_Ghosts.c	(revision 41892)
@@ -136,5 +136,5 @@
     pmFPAview *view = pmFPAviewAlloc (0);
 
-    //We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
+    // We need to check whether we are dealing with an old style ghost_model, or a new style model. Check if the mirror_rad polynomial exists
     float mirCheck = 0;
     md = psMetadataLookupMetadata (&status, ghostModel, "GHOST.MIRROR.RAD"); 
@@ -153,5 +153,4 @@
     GET_1D_POLY ("GHOST.INNER.MINOR", innerMinor);
 
-
     // select the input astrometry data (also carries the refstars)
     pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
@@ -211,5 +210,6 @@
      	                double theta0 = atan2(ref->FP->y,ref->FP->x);
 
-                        if(mirCheck) {
+			// EAM: XXX we should just use the existence of mirrorRad (!= NULL) instead of carrying a different bool
+                        if (mirCheck) {
                             //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle
 		            double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc);
@@ -220,6 +220,5 @@
 		            ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
 		            ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror);
-                        }  
-                        if(!mirCheck) {
+                        } else {
                             //Use the old-style ghost position determination
                             ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y);
@@ -303,4 +302,5 @@
     	psFree (outerMajor);
     	psFree (outerMinor);
+    	psFree (mirrorRad);
     	psFree (ghostModel);
     	psFree (view);
@@ -327,4 +327,5 @@
     psFree (outerMajor);
     psFree (outerMinor);
+    psFree (mirrorRad);
     psFree (ghostModel);
     psFree (view);
