Saroj kumar Panda
unread,Aug 26, 2014, 2:21:05 AM8/26/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to uth...@googlegroups.com
Hi,
I am using uthash for a long time. But for the last two days am getting a strange result. I am clueless about it.
Let me elaborate
The function am using is
int is_exist_in_hash(char *key) {
struct internal_data_buff_t *s = NULL;
if (pthread_rwlock_rdlock(&lock) != 0) log4c_category_log(mycat, LOG4C_PRIORITY_DEBUG,"cannot lock");
HASH_FIND_STR( hash_int, key, s ); /* s: output pointer */
pthread_rwlock_unlock(&lock);
if(s)
return 1;
else
return 0;
}
the structure for the same is
struct internal_data_buff_t
{
char sno[32];
char url[4048];
int status_flag;
int thrd_index;
UT_hash_handle hh;
};
It works but running after multiple times it give segfault on the HASH_FIND_STR
in the gdb it shows like
Program terminated with signal 11, Segmentation fault.
112 HASH_FIND_STR( hash_int, key, s ); /* s: output pointer */
(gdb) bt
#0 0x0000000000407c3b in is_exist_in_hash (key=0x41c07fc0 "3121001328") at Hash_Operation.c:112
I am not sure why it is giving segfault afer certain run . Can anybody please help me on this.
Thanks
Saroj