1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

cameradevice: fixed a regression

Memory would sometimes not be freed.
Caused by 8776682d44803abfb217194396ad4fd2b9c33052
This commit is contained in:
Dmytro Shynkevych 2015-10-05 21:21:12 -04:00
parent 88cce4e137
commit c491f79077

View File

@ -225,8 +225,11 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
if (av_opt_set_dict2(s, &tmp, AV_OPT_SEARCH_CHILDREN) < 0)
{
av_dict_free(&tmp);
avformat_free_context(s);
}
avdevice_list_devices(s, &devlist);
av_dict_free(&tmp);
avformat_free_context(s);
if (!devlist)
{
qWarning() << "avdevice_list_devices failed";
@ -242,7 +245,6 @@ QVector<QPair<QString, QString>> CameraDevice::getRawDeviceListGeneric()
devices[i].second = dev->device_description;
}
avdevice_free_list_devices(&devlist);
avformat_free_context(s);
return devices;
}