update
diff --git a/nlsr.c b/nlsr.c
index 6655558..3895e5f 100644
--- a/nlsr.c
+++ b/nlsr.c
@@ -250,14 +250,17 @@
hashtb_start(nlsr->npl, e);
res = hashtb_seek(e, np->name, strlen(np->name), 0);
- assert(res == HT_NEW_ENTRY);
+ if(res == HT_NEW_ENTRY)
+ {
- hnp = e->data;
- hnp->name=(char *)malloc(np->length);
- memcpy(hnp->name,np->name,np->length);
- hnp->length=np->length;
+ hnp = e->data;
+ hnp->name=(char *)malloc(np->length);
+ memcpy(hnp->name,np->name,np->length);
+ hnp->length=np->length;
+ }
+
+ hashtb_end(e);
- hashtb_end(e);
printf("\n");
diff --git a/nlsr_adl.c b/nlsr_adl.c
index 62aff9d..c23d87c 100644
--- a/nlsr_adl.c
+++ b/nlsr_adl.c
@@ -37,23 +37,25 @@
hashtb_start(nlsr->adl, e);
res = hashtb_seek(e, nbr->neighbor->name , nbr->neighbor->length, 0);
- assert (res == HT_NEW_ENTRY);
+ if(res == HT_NEW_ENTRY )
+ {
- hnbr = e->data;
+ hnbr = e->data;
- hnbr->neighbor=(struct name_prefix *)malloc(sizeof(struct name_prefix *));
- hnbr->neighbor->name=(char *)malloc(nbr->neighbor->length);
- memcpy(hnbr->neighbor->name,nbr->neighbor->name,nbr->neighbor->length);
- hnbr->last_lsdb_version=(char *)malloc(15);
+ hnbr->neighbor=(struct name_prefix *)malloc(sizeof(struct name_prefix *));
+ hnbr->neighbor->name=(char *)malloc(nbr->neighbor->length);
+ memcpy(hnbr->neighbor->name,nbr->neighbor->name,nbr->neighbor->length);
+ hnbr->last_lsdb_version=(char *)malloc(15);
- hnbr->neighbor->length=nbr->neighbor->length;
- hnbr->face=nbr->face;
- hnbr->status=nbr->status;
- memcpy(hnbr->last_lsdb_version,"00000000000000",14);
- memcpy(hnbr->last_lsdb_version+strlen(hnbr->last_lsdb_version),"\0",1);
+ hnbr->neighbor->length=nbr->neighbor->length;
+ hnbr->face=nbr->face;
+ hnbr->status=nbr->status;
+ memcpy(hnbr->last_lsdb_version,"00000000000000",14);
+ memcpy(hnbr->last_lsdb_version+strlen(hnbr->last_lsdb_version),"\0",1);
- struct hashtb_param param_luq = {0};
- hnbr->lsa_update_queue=hashtb_create(200, ¶m_luq);
+ struct hashtb_param param_luq = {0};
+ hnbr->lsa_update_queue=hashtb_create(200, ¶m_luq);
+ }
hashtb_end(e);
@@ -102,10 +104,11 @@
res = hashtb_seek(e, nbr->buf, nbr->length, 0);
- assert( res == HT_OLD_ENTRY);
-
- nnbr=e->data;
- nnbr->status=status;
+ if (res == HT_OLD_ENTRY)
+ {
+ nnbr=e->data;
+ nnbr->status=status;
+ }
hashtb_end(e);
}
@@ -125,10 +128,10 @@
hashtb_start(nlsr->adl, e);
res = hashtb_seek(e, nbr->buf, nbr->length, 0);
- assert( res == HT_OLD_ENTRY);
-
- nnbr=e->data;
- memcpy(nnbr->last_lsdb_version,version,strlen(version)+1);
-
+ if( res == HT_OLD_ENTRY )
+ {
+ nnbr=e->data;
+ memcpy(nnbr->last_lsdb_version,version,strlen(version)+1);
+ }
hashtb_end(e);
}