mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-28 17:42:28 +08:00
bpm: Fix potential null-pointer dereference
`update_metrics()` in `bpm.c` is checking for null pointer arguments, and there was a very minor chance of dereferencing a null-pointer in the logged message. Correct the logic to prevent this from happening.
This commit is contained in:
committed by
Ryan Foster
parent
80ea1b14fb
commit
64cb68af56
+6
-1
@@ -16,7 +16,12 @@ static void render_metrics_time(struct metrics_time *m_time)
|
||||
static bool update_metrics(obs_output_t *output, const struct encoder_packet *pkt,
|
||||
const struct encoder_packet_time *ept, struct metrics_data *m_track)
|
||||
{
|
||||
if (!output || !pkt || !ept || !m_track) {
|
||||
if (!pkt) {
|
||||
blog(LOG_DEBUG, "%s: Null encoder_packet pointer", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!output || !ept || !m_track) {
|
||||
blog(LOG_DEBUG, "%s: Null arguments for track %lu", __FUNCTION__, pkt->track_idx);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user