Sfoglia il codice sorgente

Merge pull request #103897 from bruvzg/as_leak

Fix AudioServer missing deletes.
Thaddeus Crews 6 mesi fa
parent
commit
3d5a74cc48
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      servers/audio_server.cpp

+ 5 - 2
servers/audio_server.cpp

@@ -1230,6 +1230,7 @@ void AudioServer::start_playback_stream(Ref<AudioStreamPlayback> p_playback, con
 	int idx = 0;
 	int idx = 0;
 	for (KeyValue<StringName, Vector<AudioFrame>> pair : p_bus_volumes) {
 	for (KeyValue<StringName, Vector<AudioFrame>> pair : p_bus_volumes) {
 		if (pair.value.size() < channel_count || pair.value.size() != MAX_CHANNELS_PER_BUS) {
 		if (pair.value.size() < channel_count || pair.value.size() != MAX_CHANNELS_PER_BUS) {
+			delete playback_node;
 			delete new_bus_details;
 			delete new_bus_details;
 			ERR_FAIL();
 			ERR_FAIL();
 		}
 		}
@@ -1322,8 +1323,10 @@ void AudioServer::set_playback_bus_volumes_linear(Ref<AudioStreamPlayback> p_pla
 		if (idx >= MAX_BUSES_PER_PLAYBACK) {
 		if (idx >= MAX_BUSES_PER_PLAYBACK) {
 			break;
 			break;
 		}
 		}
-		ERR_FAIL_COND(pair.value.size() < channel_count);
-		ERR_FAIL_COND(pair.value.size() != MAX_CHANNELS_PER_BUS);
+		if (pair.value.size() < channel_count || pair.value.size() != MAX_CHANNELS_PER_BUS) {
+			delete new_bus_details;
+			ERR_FAIL();
+		}
 
 
 		new_bus_details->bus_active[idx] = true;
 		new_bus_details->bus_active[idx] = true;
 		new_bus_details->bus[idx] = pair.key;
 		new_bus_details->bus[idx] = pair.key;