(svn r25956) -Fix [FS#5772]: temporary persistent storage modifications, e.g. command tests or those from GUI, were not properly reset, creating the possibility of desyncs

This commit is contained in:
rubidium 2013-11-08 22:28:57 +00:00
parent 169bf3a403
commit c04d635ddb
1 changed files with 2 additions and 1 deletions

View File

@ -84,7 +84,7 @@ struct PersistentStorageArray : BaseStorageArray {
if (this->storage[pos] == value) return;
/* We do not have made a backup; lets do so */
if (this->prev_storage != NULL) {
if (this->prev_storage == NULL) {
this->prev_storage = MallocT<TYPE>(SIZE);
memcpy(this->prev_storage, this->storage, sizeof(this->storage));
@ -121,6 +121,7 @@ struct PersistentStorageArray : BaseStorageArray {
memcpy(this->storage, this->prev_storage, sizeof(this->storage));
}
free(this->prev_storage);
this->prev_storage = NULL;
}
};