add: if (sockfd != -1) close(sockfd);
context: TC_INIT(const char *tablename){	TC_HANDLE_T h;	STRUCT_GETINFO info;	unsigned int i;	int tmp;	socklen_t s;	iptc_fn = TC_INIT;	sockfd = socket(TC_AF, SOCK_RAW, IPPROTO_RAW);	if (sockfd < 0)		return NULL;	s = sizeof(info);	if (strlen(tablename) >= TABLE_MAXNAMELEN) {		errno = EINVAL;		return NULL;	}	strcpy(info.name, tablename);	if (getsockopt(sockfd, TC_IPPROTO, SO_GET_INFO, &info, &s) < 0)		return NULL;	if ((h = alloc_handle(info.name, info.size, info.num_entries))	    == NULL)		return NULL;/* Too hard --RR */#if 0	sprintf(pathname, "%s/%s", IPT_LIB_DIR, info.name);	dynlib = dlopen(pathname, RTLD_NOW);	if (!dynlib) {		errno = ENOENT;		return NULL;	}	h->hooknames = dlsym(dynlib, "hooknames");	if (!h->hooknames) {		errno = ENOENT;		return NULL;	}#else	h->hooknames = hooknames;#endif	/* Initialize current state */	h->info = info;	h->new_number = h->info.num_entries;	for (i = 0; i < h->info.num_entries; i++)		h->counter_map[i]			= ((struct counter_map){COUNTER_MAP_NORMAL_MAP, i});	h->entries.size = h->info.size;	tmp = sizeof(STRUCT_GET_ENTRIES) + h->info.size;	if (getsockopt(sockfd, TC_IPPROTO, SO_GET_ENTRIES, &h->entries,		       &tmp) < 0) {		free(h);		return NULL;	}	CHECK(h);	return h;}