History

avdevice/decklink: fix leak when listing devices and there is no memory

Fixes Coverity CID 1419523.

Marton Balint committed 8 years ago

Commit 87455b71 parent 5f6126e1 file · +5 −12Browse files

Showing the changes to libavdevice/decklink_common.cpp (1 of 1 file). Show all

Unified · Split

libavdevice/decklink_common.cpp+5−12
@@ -322,21 +322,14 @@ int ff_decklink_list_devices(AVFormatContext *avctx, · 321 unmodified lines
322 ret = AVERROR(ENOMEM);322 ret = AVERROR(ENOMEM);
323 goto next;323 goto next;
324 }324 }
325 new_device->device_name = av_strdup(displayName);
326 if (!new_device->device_name) {
327 ret = AVERROR(ENOMEM);
328 goto next;
329 }
330 325
326 new_device->device_name = av_strdup(displayName);
331 new_device->device_description = av_strdup(displayName);327 new_device->device_description = av_strdup(displayName);
332 if (!new_device->device_description) {
333 av_freep(&new_device->device_name);
334 ret = AVERROR(ENOMEM);
335 goto next;
336 }
337 328
338 if ((ret = av_dynarray_add_nofree(&device_list->devices,329 if (!new_device->device_name ||
339 &device_list->nb_devices, new_device)) < 0) {330 !new_device->device_description ||
331 av_dynarray_add_nofree(&device_list->devices, &device_list->nb_devices, new_device) < 0) {
332 ret = AVERROR(ENOMEM);
340 av_freep(&new_device->device_name);333 av_freep(&new_device->device_name);
341 av_freep(&new_device->device_description);334 av_freep(&new_device->device_description);
342 av_freep(&new_device);335 av_freep(&new_device);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t