scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

coff32del.c (475B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 
      4 #include <scc/mach.h>
      5 
      6 #include "../libmach.h"
      7 #include "coff32.h"
      8 
      9 void
     10 coff32del(Obj *obj)
     11 {
     12 	int i;
     13 	struct coff32 *coff = obj->data;
     14 
     15 	if (coff) {
     16 		free(coff->scns);
     17 		free(coff->ents);
     18 		free(coff->strtbl);
     19 
     20 		for (i = 0; i < coff->hdr.f_nscns; i++) {
     21 			if (coff->rels)
     22 				free(coff->rels[i]);
     23 			if (coff->lines)
     24 				free(coff->lines[i]);
     25 		}
     26 		free(coff->rels);
     27 		free(coff->lines);
     28 	}
     29 	free(obj->data);
     30 	obj->data = NULL;
     31 }