summaryrefslogtreecommitdiff
path: root/src/fb.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2021-02-17 11:07:45 -0800
committerVito Caputo <vcaputo@pengaru.com>2021-02-17 11:07:45 -0800
commit55db80c6970b8643b4777c3b5586531e2d2e7469 (patch)
treeab4178a33ebc1c8d77ec6669a6c0d433574257c8 /src/fb.c
parent9e56788affedd6b01df6764732a4ba786f7a47f3 (diff)
fb,settings: return NULL from _free() methods
and ignore NULL parameters as benign
Diffstat (limited to 'src/fb.c')
-rw-r--r--src/fb.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/fb.c b/src/fb.c
index 03a04ac..f24e4fe 100644
--- a/src/fb.c
+++ b/src/fb.c
@@ -239,22 +239,26 @@ void fb_get_put_pages_count(fb_t *fb, unsigned *count)
/* free the fb and associated resources */
-void fb_free(fb_t *fb)
+fb_t * fb_free(fb_t *fb)
{
- if (fb->active_page)
- fb_release(fb);
+ if (fb) {
+ if (fb->active_page)
+ fb_release(fb);
- /* TODO: free all the pages */
+ /* TODO: free all the pages */
- if (fb->ops->shutdown && fb->ops_context)
- fb->ops->shutdown(fb, fb->ops_context);
+ if (fb->ops->shutdown && fb->ops_context)
+ fb->ops->shutdown(fb, fb->ops_context);
- pthread_mutex_destroy(&fb->ready_mutex);
- pthread_cond_destroy(&fb->ready_cond);
- pthread_mutex_destroy(&fb->inactive_mutex);
- pthread_cond_destroy(&fb->inactive_cond);
+ pthread_mutex_destroy(&fb->ready_mutex);
+ pthread_cond_destroy(&fb->ready_cond);
+ pthread_mutex_destroy(&fb->inactive_mutex);
+ pthread_cond_destroy(&fb->inactive_cond);
- free(fb);
+ free(fb);
+ }
+
+ return NULL;
}
© All Rights Reserved