예제 #1
0
파일: cntr.c 프로젝트: jkniiv/burp
void cntr_free(struct cntr **cntr)
{
	int c;
	if(!cntr || !*cntr) return;
	if((*cntr)->ent)
	{
		for(c=0; c<(*cntr)->colen; c++)
			cntr_ent_free(
				(*cntr)->ent[(uint8_t)(*cntr)->cmd_order[c]]);
		free((*cntr)->ent);
	}
	if((*cntr)->status) free((*cntr)->status);
	free(*cntr);
	*cntr=NULL;
}
예제 #2
0
파일: cntr.c 프로젝트: Sherlock221B/burp
void cntr_free(struct cntr **cntr)
{
	struct cntr_ent *e;
	struct cntr_ent *l=NULL;
	if(!cntr || !*cntr) return;
	for(e=(*cntr)->list; e; e=l)
	{
		l=e->next;
		cntr_ent_free(e);
	}
	(*cntr)->list=NULL;
	if((*cntr)->status) free((*cntr)->status);
	free(*cntr);
	*cntr=NULL;
}
예제 #3
0
파일: cntr.c 프로젝트: jkniiv/burp
int add_cntr_ent(struct cntr *cntr, int versions,
	char cmd, const char *field, const char *label)
{
	struct cntr_ent *cenew=NULL;
	if((!cntr->ent
	  && !(cntr->ent=(struct cntr_ent **)
	    calloc_w(1, CNTR_ENT_SIZE*sizeof(struct cntr_ent **), __func__)))
	  || !(cenew=(struct cntr_ent *)
	    calloc_w(1, sizeof(struct cntr_ent), __func__))
	  || !(cenew->field=strdup_w(field, __func__))
	  || !(cenew->label=strdup_w(label, __func__)))
		goto error;
	cenew->versions=versions;
	cntr->ent[(uint8_t)cmd]=cenew;
	cntr->cmd_order[cntr->colen++]=cmd;
	return 0;
error:
	cntr_ent_free(cenew);
	return -1;
}
예제 #4
0
파일: cntr.c 프로젝트: Sherlock221B/burp
static int add_cntr_ent(struct cntr *cntr, int flags,
	char cmd, const char *field, const char *label)
{
	struct cntr_ent *cenew=NULL;
	if(!(cenew=(struct cntr_ent *)
	    calloc_w(1, sizeof(struct cntr_ent), __func__))
	  || !(cenew->field=strdup_w(field, __func__))
	  || !(cenew->label=strdup_w(label, __func__)))
		goto error;
	cenew->flags=flags;

	if(cntr->list) cenew->next=cntr->list;
	cntr->list=cenew;

	cntr->ent[(uint8_t)cmd]=cenew;
	return 0;
error:
	cntr_ent_free(cenew);
	return -1;
}