P
Pieter Claassen
The following code works in a test case, but when I try to run it in a
larger program, it consistently fails. gdm indicates that the problem
comes in with realloc.
I am doing anything obviously stupid?
Thanks in advance.
P
pkt_t *get_state(char *ident){
fprintf(stderr,"ENTER GET STATE \n");
ENTRY e,*t;
pkt_t *packet;
fprintf(stderr,"ID=%s\n",ident);
e.key=ident;
fprintf(stderr,"JUST SET THE KEY\n");
t=hsearch(e,ENTER);
fprintf(stderr,"JUST DONE A SEARCH\n");
if (t == NULL){
fprintf(stderr,"NO ENTRY FOUND\n");
return NULL;
}
fprintf(stderr,"JUST FINISHED THE LOOKUP AND FOUND SOMETHING\n");
//Cast pointer to struct pkt and get to state member
packet=((pkt_t*)t->data);
//Now return it
fprintf(stderr,"EXIT GET STATE \n");
return packet;
}
larger program, it consistently fails. gdm indicates that the problem
comes in with realloc.
I am doing anything obviously stupid?
Thanks in advance.
P
pkt_t *get_state(char *ident){
fprintf(stderr,"ENTER GET STATE \n");
ENTRY e,*t;
pkt_t *packet;
fprintf(stderr,"ID=%s\n",ident);
e.key=ident;
fprintf(stderr,"JUST SET THE KEY\n");
t=hsearch(e,ENTER);
fprintf(stderr,"JUST DONE A SEARCH\n");
if (t == NULL){
fprintf(stderr,"NO ENTRY FOUND\n");
return NULL;
}
fprintf(stderr,"JUST FINISHED THE LOOKUP AND FOUND SOMETHING\n");
//Cast pointer to struct pkt and get to state member
packet=((pkt_t*)t->data);
//Now return it
fprintf(stderr,"EXIT GET STATE \n");
return packet;
}