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

cameradevice: fixed a major leak: avformat_context not always freed

This commit is contained in:
Dmytro Shynkevych 2015-10-04 17:14:51 -04:00
parent 45a3d7ca30
commit 8776682d44

View File

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