diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-01-29 14:01:55 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-29 14:01:55 -0500 |
commit | 3c243ac20889db3ea11682597a80e7774617d409 (patch) | |
tree | 3ef1de8095070928d707383a5c7b13f7eb8a89e1 /examples/dmabuf-capture.c | |
parent | c6b4153748f8e53363cda87edfea43a432f4a255 (diff) | |
parent | 7309d8c9ac2767c75f52aba0abba22cbf5384966 (diff) |
Merge pull request #1511 from emersion/scan-build-fixes
Fix two issues found with Clang's static analyzer
Diffstat (limited to 'examples/dmabuf-capture.c')
-rw-r--r-- | examples/dmabuf-capture.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/dmabuf-capture.c b/examples/dmabuf-capture.c index ebbe0a70..cbe50e7d 100644 --- a/examples/dmabuf-capture.c +++ b/examples/dmabuf-capture.c @@ -228,13 +228,14 @@ static const struct wl_registry_listener registry_listener = { static void frame_free(void *opaque, uint8_t *data) { AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)data; - for (int i = 0; i < desc->nb_objects; ++i) { - close(desc->objects[i].fd); + if (desc) { + for (int i = 0; i < desc->nb_objects; ++i) { + close(desc->objects[i].fd); + } + av_free(data); } zwlr_export_dmabuf_frame_v1_destroy(opaque); - - av_free(data); } static void frame_start(void *data, struct zwlr_export_dmabuf_frame_v1 *frame, |