Line data Source code
1 : #include <stdlib.h> 2 : #include "grib2.h" 3 : 4 472 : void g2_free(gribfield *gfld) 5 : //$$$ SUBPROGRAM DOCUMENTATION BLOCK 6 : // . . . . 7 : // SUBPROGRAM: g2_free 8 : // PRGMMR: Gilbert ORG: W/NP11 DATE: 2002-10-28 9 : // 10 : // ABSTRACT: This routine frees up memory that was allocated for 11 : // struct gribfield. 12 : // 13 : // PROGRAM HISTORY LOG: 14 : // 2002-10-28 Gilbert 15 : // 16 : // USAGE: g2_free(gribfield *gfld) 17 : // ARGUMENT: 18 : // gfld - pointer to gribfield structure (defined in include file grib2.h) 19 : // returned from routine g2_getfld. 20 : // 21 : // REMARKS: This routine must be called to free up memory used by 22 : // the decode routine, g2_getfld, when user no longer needs to 23 : // reference this data. 24 : // 25 : // ATTRIBUTES: 26 : // LANGUAGE: C 27 : // MACHINE: 28 : // 29 : //$$$ 30 : { 31 : 32 472 : if (gfld->idsect != 0 ) free(gfld->idsect); 33 472 : if (gfld->local != 0 ) free(gfld->local); 34 472 : if (gfld->list_opt != 0 ) free(gfld->list_opt); 35 472 : if (gfld->igdtmpl != 0 ) free(gfld->igdtmpl); 36 472 : if (gfld->ipdtmpl != 0 ) free(gfld->ipdtmpl); 37 472 : if (gfld->coord_list != 0 ) free(gfld->coord_list); 38 472 : if (gfld->idrtmpl != 0 ) free(gfld->idrtmpl); 39 472 : if (gfld->bmap != 0 ) free(gfld->bmap); 40 472 : if (gfld->fld != 0 ) free(gfld->fld); 41 472 : free(gfld); 42 : 43 472 : return; 44 : }