*** empty log message ***
[IRC.git] / Robust / src / Runtime / DSTM / interface / llookup.c
index 02469a149b890c09a5a5b616290c132f82d367c2..cc989a289707f29d0c3d7cd0206b0388acff467e 100644 (file)
@@ -64,6 +64,7 @@ unsigned int lhashInsert(unsigned int oid, unsigned int mid) {
        } else {                        // Insert in the linked list
                if ((node = calloc(1, sizeof(lhashlistnode_t))) == NULL) {
                        printf("Calloc error %s, %d\n", __FILE__, __LINE__);
+                       pthread_mutex_unlock(&llookup.locktable);
                        return 1;
                }
                node->oid = oid;
@@ -87,6 +88,7 @@ unsigned int lhashSearch(unsigned int oid) {
        pthread_mutex_lock(&llookup.locktable);
        while(node != NULL) {
                if(node->oid == oid) {
+                       pthread_mutex_unlock(&llookup.locktable);
                        return node->mid;
                }
                node = node->next;
@@ -122,6 +124,7 @@ unsigned int lhashRemove(unsigned int oid) {
                                prev->next = curr->next;
                                free(curr);
                        }
+                       pthread_mutex_unlock(&llookup.locktable);
                        return 0;
                }       
                prev = curr;