|
|
|
@ -157,7 +157,7 @@ static void subhier_clean(struct mosquitto_db *db, struct mosquitto__subhier **s
|
|
|
|
|
leaf = nextleaf;
|
|
|
|
|
}
|
|
|
|
|
if(peer->retained){
|
|
|
|
|
db__msg_store_deref(db, &peer->retained);
|
|
|
|
|
db__msg_store_ref_dec(db, &peer->retained);
|
|
|
|
|
}
|
|
|
|
|
subhier_clean(db, &peer->children);
|
|
|
|
|
mosquitto__free(peer->topic);
|
|
|
|
@ -232,7 +232,12 @@ void db__msg_store_clean(struct mosquitto_db *db)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void db__msg_store_deref(struct mosquitto_db *db, struct mosquitto_msg_store **store)
|
|
|
|
|
void db__msg_store_ref_inc(struct mosquitto_msg_store *store)
|
|
|
|
|
{
|
|
|
|
|
store->ref_count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void db__msg_store_ref_dec(struct mosquitto_db *db, struct mosquitto_msg_store **store)
|
|
|
|
|
{
|
|
|
|
|
(*store)->ref_count--;
|
|
|
|
|
if((*store)->ref_count == 0){
|
|
|
|
@ -271,7 +276,7 @@ static void db__message_remove(struct mosquitto_db *db, struct mosquitto_msg_dat
|
|
|
|
|
msg_data->msg_count12--;
|
|
|
|
|
msg_data->msg_bytes12 -= item->store->payloadlen;
|
|
|
|
|
}
|
|
|
|
|
db__msg_store_deref(db, &item->store);
|
|
|
|
|
db__msg_store_ref_dec(db, &item->store);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mosquitto_property_free_all(&item->properties);
|
|
|
|
@ -450,7 +455,7 @@ int db__message_insert(struct mosquitto_db *db, struct mosquitto *context, uint1
|
|
|
|
|
msg->prev = NULL;
|
|
|
|
|
msg->next = NULL;
|
|
|
|
|
msg->store = stored;
|
|
|
|
|
msg->store->ref_count++;
|
|
|
|
|
db__msg_store_ref_inc(msg->store);
|
|
|
|
|
msg->mid = mid;
|
|
|
|
|
msg->timestamp = mosquitto_time();
|
|
|
|
|
msg->direction = dir;
|
|
|
|
@ -543,7 +548,7 @@ void db__messages_delete_list(struct mosquitto_db *db, struct mosquitto_client_m
|
|
|
|
|
|
|
|
|
|
DL_FOREACH_SAFE(*head, tail, tmp){
|
|
|
|
|
DL_DELETE(*head, tail);
|
|
|
|
|
db__msg_store_deref(db, &tail->store);
|
|
|
|
|
db__msg_store_ref_dec(db, &tail->store);
|
|
|
|
|
mosquitto_property_free_all(&tail->properties);
|
|
|
|
|
mosquitto__free(tail);
|
|
|
|
|
}
|
|
|
|
|