Add(Audio|Video)Track: fix memory leak on failure
quiets a static analysis warning Change-Id: Iaa6909e94deae81ace3e65f37ab746d72031620f
This commit is contained in:
parent
a65b9e0287
commit
b0cea9ce24
@ -3361,7 +3361,10 @@ uint64_t Segment::AddVideoTrack(int32_t width, int32_t height, int32_t number) {
|
||||
track->set_width(width);
|
||||
track->set_height(height);
|
||||
|
||||
tracks_.AddTrack(track, number);
|
||||
if (!tracks_.AddTrack(track, number)) {
|
||||
delete track;
|
||||
return 0;
|
||||
}
|
||||
has_video_ = true;
|
||||
|
||||
return track->number();
|
||||
@ -3401,7 +3404,10 @@ uint64_t Segment::AddAudioTrack(int32_t sample_rate, int32_t channels,
|
||||
track->set_sample_rate(sample_rate);
|
||||
track->set_channels(channels);
|
||||
|
||||
tracks_.AddTrack(track, number);
|
||||
if (!tracks_.AddTrack(track, number)) {
|
||||
delete track;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return track->number();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user