rtmp-services: Avoid calling bmemdup on NULL resolution list

This commit is contained in:
Richard Stanway 2022-07-18 23:12:49 +02:00
parent 6eb5a922a7
commit 174e91f211
No known key found for this signature in database
GPG Key ID: 4F96FCA24BCE7BA1

View File

@ -751,9 +751,16 @@ static void rtmp_common_get_supported_resolutions(
void *data, struct obs_service_resolution **resolutions, size_t *count)
{
struct rtmp_common *service = data;
*count = service->supported_resolutions_count;
*resolutions = bmemdup(service->supported_resolutions,
*count * sizeof(struct obs_service_resolution));
if (service->supported_resolutions_count) {
*count = service->supported_resolutions_count;
*resolutions =
bmemdup(service->supported_resolutions,
*count * sizeof(struct obs_service_resolution));
} else {
*count = 0;
*resolutions = NULL;
}
}
static void rtmp_common_get_max_fps(void *data, int *fps)