[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #ODF-774270]: parallel file open segmentation fault



Max,

Here is a patch for the bug you reported in ncdump/dumplib.c.
Thanks for reporting and diagnosing the problem.  This patch
will have been applied to the next snapshot release we make
available, in case you can wait until then.

--Russ

cvs diff: Diffing .
Index: dumplib.c
===================================================================
RCS file: /upc/share/CVS/netcdf-3/ncdump/dumplib.c,v
retrieving revision 1.59
diff -p -r1.59 dumplib.c
*** dumplib.c   10 Jun 2008 20:32:43 -0000      1.59
--- dumplib.c   14 Jun 2008 12:36:22 -0000
*************** init_types(int ncid) {
*** 1605,1622 ****
                  int rank;
                  int *sides;
                  int i;
                  NC_CHECK( nc_inq_compound_field(ncid, tinfo->tid, fidx, NULL,
                                                  &offset, &ftype, &rank,
                                                  sides) );
                  tinfo->fids[fidx] = ftype;
                  tinfo->offsets[fidx] = offset;
                  tinfo->ranks[fidx] = rank;
!                 tinfo->sides[fidx] = (int *) emalloc(rank * sizeof(int));
                  tinfo->nvals[fidx] = 1;
                  for(i = 0; i < rank; i++) {
                      tinfo->sides[fidx][i] = sides[i];
                      tinfo->nvals[fidx] *= sides[i];
                  }
              }
              break;
          case NC_VLEN:
--- 1605,1629 ----
                  int rank;
                  int *sides;
                  int i;
+                 sides = NULL;
                  NC_CHECK( nc_inq_compound_field(ncid, tinfo->tid, fidx, NULL,
                                                  &offset, &ftype, &rank,
                                                  sides) );
+                 sides = (int *) emalloc(rank * sizeof(int));
+                 NC_CHECK( nc_inq_compound_field(ncid, tinfo->tid, fidx, NULL,
+                                                 NULL, NULL, NULL, sides) );
                  tinfo->fids[fidx] = ftype;
                  tinfo->offsets[fidx] = offset;
                  tinfo->ranks[fidx] = rank;
!                 if (rank > 0)
!                     tinfo->sides[fidx] = (int *) emalloc(rank * sizeof(int));
                  tinfo->nvals[fidx] = 1;
                  for(i = 0; i < rank; i++) {
                      tinfo->sides[fidx][i] = sides[i];
                      tinfo->nvals[fidx] *= sides[i];
                  }
+                 if (rank > 0)
+                     free(sides);
              }
              break;
          case NC_VLEN:

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: ODF-774270
Department: Support netCDF
Priority: Normal
Status: Closed