summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 547dfb0)
raw | patch | inline | side by side (parent: 547dfb0)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 2 Jan 2013 09:18:01 +0000 (10:18 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 2 Jan 2013 09:18:01 +0000 (10:18 +0100) |
Release the lock before returning in error conditions.
src/core/store.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 3e9ec55eec519087f63bddf444fb6ed5df24660a..8dc256ea5645563cc59b4e687eb498ade64e6533 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
char errbuf[1024];
fprintf(stderr, "store: Failed to clone host object: %s\n",
sc_strerror(errno, errbuf, sizeof(errbuf)));
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
"host object '%s': %s\n", host->host_name,
sc_strerror(errno, errbuf, sizeof(errbuf)));
sc_object_deref(SC_OBJ(new));
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
}
"host object '%s': %s\n", host->host_name,
sc_strerror(errno, errbuf, sizeof(errbuf)));
sc_object_deref(SC_OBJ(new));
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
}
host = SC_HOST(sc_llist_search(host_list, (const sc_object_t *)&lookup,
sc_cmp_store_obj_with_name));
- if (! host)
+ if (! host) {
+ pthread_rwlock_unlock(&host_lock);
return -1;
+ }
lookup.obj_name = attr->attr_name;
old = SC_ATTR(sc_llist_search(host->attributes,
char errbuf[1024];
fprintf(stderr, "store: Failed to clone attribute object: %s\n",
sc_strerror(errno, errbuf, sizeof(errbuf)));
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
host = SC_HOST(sc_llist_search(host_list, (const sc_object_t *)&lookup,
sc_cmp_store_obj_with_name));
- if (! host)
+ if (! host) {
+ pthread_rwlock_unlock(&host_lock);
return -1;
+ }
lookup.obj_name = svc->svc_name;
old = SC_SVC(sc_llist_search(host->services, (const sc_object_t *)&lookup,
char errbuf[1024];
fprintf(stderr, "store: Failed to clone service object: %s\n",
sc_strerror(errno, errbuf, sizeof(errbuf)));
+ pthread_rwlock_unlock(&host_lock);
return -1;
}
pthread_rwlock_rdlock(&host_lock);
host_iter = sc_llist_get_iter(host_list);
- if (! host_iter)
+ if (! host_iter) {
+ pthread_rwlock_unlock(&host_lock);
return -1;
+ }
while (sc_llist_iter_has_next(host_iter)) {
sc_host_t *host = SC_HOST(sc_llist_iter_get_next(host_iter));
}
sc_llist_iter_destroy(host_iter);
+ pthread_rwlock_unlock(&host_lock);
return 0;
} /* sc_store_dump */