Fixes Coverity CID 1419523.
Unified · Split
| @@ -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); |