Code

store: Free old attribute values before storing an updated value.
authorSebastian Harl <sh@tokkee.org>
Tue, 22 Apr 2014 20:06:47 +0000 (22:06 +0200)
committerSebastian Harl <sh@tokkee.org>
Tue, 22 Apr 2014 20:06:47 +0000 (22:06 +0200)
src/core/store.c

index dace58f899f78ac27d681f22927ed088a7850170..6d9c971702b4e696ca14991eb2ea4f4e4716413c 100644 (file)
@@ -481,6 +481,7 @@ sdb_store_attribute(const char *hostname,
 
        if (status >= 0) {
                assert(updated_attr);
 
        if (status >= 0) {
                assert(updated_attr);
+               sdb_data_free_datum(&SDB_ATTR(updated_attr)->value);
                if (sdb_data_copy(&SDB_ATTR(updated_attr)->value, value)) {
                        sdb_object_deref(SDB_OBJ(updated_attr));
                        status = -1;
                if (sdb_data_copy(&SDB_ATTR(updated_attr)->value, value)) {
                        sdb_object_deref(SDB_OBJ(updated_attr));
                        status = -1;