IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2017, 10:29:25 PM (9 years ago)
Author:
eugene
Message:

update image header format when changing format; avoid double-free for image table

Location:
branches/eam_branches/ohana.20170822/src/relphot
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20170822/src/relphot/include/relphot.h

    r40235 r40259  
    407407int           findMosaics         PROTO((Catalog *catalog, int Ncatalog, int doMosaicList));
    408408
     409void clearImages (void);
    409410void checkImages (char *name);
    410411int dumpMags (FILE *fout, Catalog *catalog, int Ncatalog);
  • branches/eam_branches/ohana.20170822/src/relphot/src/ImageOps.c

    r40239 r40259  
    11611161}
    11621162
     1163void clearImages (void) {
     1164  image = NULL;
     1165}
     1166
    11631167void checkImages (char *name) {
    11641168
    11651169  off_t i;
    11661170  fprintf (stderr, "--- %s ---\n", name);
     1171 
     1172  OhanaMemblock *ref = (OhanaMemblock *) image - 1;
     1173  fprintf (stderr, "file: %s\n", ref->file);
     1174
     1175  fprintf (stderr, "0x%08llx \n", (unsigned long long) image);
     1176
    11671177  for (i = 0; i < Nimage; i++) {
    11681178    fprintf (stderr, "%s : 0x%08x : %6.3f  %6.3f\n", image[i].name, image[i].flags, image[i].McalPSF, image[i].McalAPER);
  • branches/eam_branches/ohana.20170822/src/relphot/src/relphot_images.c

    r40246 r40259  
    228228        // ensure the db format is updated
    229229        dbX.format = dvo_catalog_catformat (UPDATE_CATFORMAT);
     230        gfits_modify (&dbX.header, "FORMAT", "%s", 1, UPDATE_CATFORMAT);
     231
    230232        char photcodeFile[1024];
    231233        sprintf (photcodeFile, "%s/Photcodes.dat", CATDIR);
     
    272274    // ensure the db format is updated
    273275    db.format = dvo_catalog_catformat (UPDATE_CATFORMAT);
     276    gfits_modify (&db.header, "FORMAT", "%s", 1, UPDATE_CATFORMAT);
    274277  }
    275278  if (CALIBRATE_STACKS_AND_WARPS || (NLOOP > 0)) {
  • branches/eam_branches/ohana.20170822/src/relphot/src/relphot_parallel_images.c

    r40246 r40259  
    170170  freeGridBins (Ncatalog);
    171171  freeImages((char *)image);
     172  free (image);
    172173
    173174  SkyListFree(skylist);
  • branches/eam_branches/ohana.20170822/src/relphot/src/relphot_parallel_regions.c

    r39643 r40259  
    8484
    8585  // save the changes to the image parameters
    86   dvo_image_save (&db, VERBOSE); // this function modifies the db.ftable.buffer: do not free stored Image table
     86  dvo_image_save (&db, VERBOSE);
     87
     88  // dvo_image_save frees db.ftable.buffer (== image) and replaces it: do not free stored Image table
     89  clearImages ();
     90
    8791  dvo_image_unlock (&db);
    8892  MARKTIME ("finished relphot -parallel-regions: %f sec total\n", dtime);
Note: See TracChangeset for help on using the changeset viewer.