Changeset 5052 for trunk/psModules/src/pmAstrometry.c
- Timestamp:
- Sep 14, 2005, 9:21:41 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmAstrometry.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmAstrometry.c
r4997 r5052 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-09-1 2 20:38:25$10 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-09-14 19:21:41 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 48 48 XXX: Is this the correct way to free database structs? 49 49 50 XXX: The meory dereferencing is not quite right with these functions. If I 50 51 52 XXX: The memory dereferencing is not quite right with these functions. If I 51 53 call the alloc functions with non-NULL pointers, there will be memory leaks. 52 54 *****************************************************************************/ … … 60 62 psFree(fpa->analysis); 61 63 psFree(fpa->camera); 64 // 65 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) 66 // in order to avoid memory reference counter problems. 67 // 68 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 69 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 70 tmpChip->parent = NULL; 71 } 62 72 psFree(fpa->chips); 63 73 psFree(fpa->header); … … 73 83 psFree(chip->concepts); 74 84 psFree(chip->analysis); 85 // 86 // Set the parent to NULL in all chip->cells before psFree(chip->cells) 87 // in order to avoid memory reference counter problems. 88 // 89 for (psS32 i = 0 ; i < chip->cells->n ; i++) { 90 pmCell *tmpCell = (pmCell *) chip->cells->data[i]; 91 tmpCell->parent = NULL; 92 } 75 93 psFree(chip->cells); 76 94 psFree(chip->parent); … … 89 107 psFree(cell->concepts); 90 108 psFree(cell->analysis); 109 // 110 // Set the parent to NULL in all cell->readouts before psFree(cell->readouts) 111 // in order to avoid memory reference counter problems. 112 // 113 for (psS32 i = 0 ; i < cell->readouts->n ; i++) { 114 pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i]; 115 tmpReadout->parent = NULL; 116 } 91 117 psFree(cell->readouts); 92 118 psFree(cell->parent); … … 122 148 tmpReadout->concepts = psMetadataAlloc(); 123 149 tmpReadout->parent = cell; 124 psMemIncrRefCounter((psPtr) cell);125 150 if (cell != NULL) { 126 151 cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout); … … 143 168 tmpCell->readouts = psArrayAlloc(0); 144 169 tmpCell->parent = chip; 145 psMemIncrRefCounter((psPtr) chip);146 170 if (chip != NULL) { 147 171 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); … … 168 192 tmpChip->cells = psArrayAlloc(0); 169 193 tmpChip->parent = fpa; 170 psMemIncrRefCounter((psPtr) fpa);171 194 if (fpa != NULL) { 172 195 fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip); 173 psMemIncrRefCounter((psPtr) tmpChip);174 196 } 175 197 tmpChip->valid = false;
Note:
See TracChangeset
for help on using the changeset viewer.
