Commit 2475fdbd authored by Lukasz Marek's avatar Lukasz Marek

lavd/avdevice: always free detected devices on error

Signed-off-by: 's avatarLukasz Marek <lukasz.m.luki@gmail.com>
parent 1aa262f4
...@@ -101,6 +101,7 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToA ...@@ -101,6 +101,7 @@ int avdevice_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToA
int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
{ {
int ret;
av_assert0(s); av_assert0(s);
av_assert0(device_list); av_assert0(device_list);
av_assert0(s->oformat || s->iformat); av_assert0(s->oformat || s->iformat);
...@@ -113,8 +114,12 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list) ...@@ -113,8 +114,12 @@ int avdevice_list_devices(AVFormatContext *s, AVDeviceInfoList **device_list)
if (!(*device_list)) if (!(*device_list))
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (s->oformat) if (s->oformat)
return s->oformat->get_device_list(s, *device_list); ret = s->oformat->get_device_list(s, *device_list);
return s->iformat->get_device_list(s, *device_list); else
ret = s->iformat->get_device_list(s, *device_list);
if (ret < 0)
avdevice_free_list_devices(device_list);
return ret;
} }
void avdevice_free_list_devices(AVDeviceInfoList **device_list) void avdevice_free_list_devices(AVDeviceInfoList **device_list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment