Changeset 9386


Ignore:
Timestamp:
08/23/11 11:23:32 (14 years ago)
Author:
Mathieu Morlighem
Message:

Some segfault fix

Location:
issm/trunk/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r9374 r9386  
    3131        double *pressureload   = NULL;
    3232        double *elements_type  = NULL;
    33         double *thickness      = NULL;
    34         double *bed            = NULL;
    3533        double *nodeoniceshelf = NULL;
    3634        double *riftinfo       = NULL;
     
    6563        /*Create pressure loads as boundary conditions. Pay attention to the partitioning if we are running in parallel (the nodes
    6664         * referenced by a certain load must belong to the cluster node): */
     65        iomodel->FetchData(3,PressureloadEnum,ThicknessEnum,BedEnum);
    6766        iomodel->FetchData(&pressureload,&numberofpressureloads,NULL,PressureloadEnum);
    6867        iomodel->FetchData(&elements_type,NULL,NULL,ElementsTypeEnum);
    69         iomodel->FetchData(&thickness,NULL,NULL,ThicknessEnum);
    70         iomodel->FetchData(&bed,NULL,NULL,BedEnum);
    7168
    7269        /*Initialize counter: */
     
    125122
    126123        /*Free data: */
     124        iomodel->DeleteData(3,PressureloadEnum,ThicknessEnum,BedEnum);
     125        xfree((void**)&elements_type);
    127126        xfree((void**)&pressureload);
    128         xfree((void**)&elements_type);
    129         xfree((void**)&thickness);
    130         xfree((void**)&bed);
    131127
    132128        /*create penalties for nodes on the base of icesheet. We must have wb=ub*db/dx+vb*db/dy */
  • issm/trunk/src/c/objects/IoModel.cpp

    r9381 r9386  
    7171        delete this->constants;
    7272
    73         for(int i=0;i<MaximumNumberOfEnums;i++) xfree((void**)&this->data[i]);
     73        /*Some checks in debugging mode*/
     74#ifdef _ISSM_DEBUG_
     75        for(int i=0;i<MaximumNumberOfEnums;i++){
     76                if(this->data[i]){
     77                        _printf_("Info: previous pointer of %s has not been freed (DeleteData has not been called)",EnumToStringx(i));
     78                }
     79        }
     80#endif
     81
    7482        xfree((void**)&this->data);
    7583
     
    489497               
    490498                dataenum=va_arg(ap, int);
     499
     500                /*Some checks in debugging mode*/
     501                /*{{{*/
     502                #ifdef _ISSM_DEBUG_
    491503                _assert_(dataenum<MaximumNumberOfEnums);
    492                 _assert_(!this->data[dataenum]);
     504                if(this->data[dataenum]){
     505                        _error_("Info: trying to fetch %s but previous pointer has not been freed (DeleteData has not been called)",EnumToStringx(dataenum));
     506                }
     507                #endif
     508                /*}}}*/
    493509
    494510                this->FetchData(&matrix,&M,&N,dataenum);
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r9362 r9386  
    6464                segment_width=6;
    6565        }
     66        _assert_(iomodel->f(PressureloadEnum));
    6667        element=(int)(*(iomodel->f(PressureloadEnum)+segment_width*i+segment_width-2)-1); //element is in the penultimate column (node1 node2 ... elem fill)
    6768
Note: See TracChangeset for help on using the changeset viewer.