summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5154fa7)
raw | patch | inline | side by side (parent: 5154fa7)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Dec 2013 14:43:06 +0000 (15:43 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Dec 2013 14:43:06 +0000 (15:43 +0100) |
src/core/store.c | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 587c527a5185699efe18d104d65f499c12801145..95aaafad9a46b370c17d0aec0e885bbb66843e1f 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
/* stored object = */ SDB_ATTRIBUTE, key, last_update,
&updated_attr);
- SDB_ATTR(updated_attr)->value = strdup(value);
- if (! SDB_ATTR(updated_attr)->value) {
- sdb_object_deref(SDB_OBJ(updated_attr));
- status = -1;
+ if (status >= 0) {
+ assert(updated_attr);
+ SDB_ATTR(updated_attr)->value = strdup(value);
+ if (! SDB_ATTR(updated_attr)->value) {
+ sdb_object_deref(SDB_OBJ(updated_attr));
+ status = -1;
+ }
}
+
pthread_rwlock_unlock(&obj_lock);
return status;
} /* sdb_store_attribute */