diff options
author | William Wilgus <wilgus.william@gmail.com> | 2021-08-13 06:32:44 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2021-08-13 06:32:44 -0400 |
commit | 2df306923a2b09aa6e46a3e24e9b0335c8016a1d (patch) | |
tree | bf44f71ffb5b21271c9294b36d8f0cd0c8cc59f2 /firmware/common | |
parent | 6de6e1459de28bef919b869ee757474c615cb787 (diff) |
file_internal.c guard file_cache_reset() from null pointer
I feel this is probably unlikely to be called with a NULL pointer
for cachep but being that we are already doing the check why not
guard file_cache_reset as well
Change-Id: I1a13767ef28a4129ae3513f7aa999fb6c1d6fad8
Diffstat (limited to 'firmware/common')
-rw-r--r-- | firmware/common/file_internal.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c index 5f35e35abc..b92c4ea115 100644 --- a/firmware/common/file_internal.c +++ b/firmware/common/file_internal.c @@ -75,13 +75,15 @@ void file_cache_alloc(struct filestr_cache *cachep) /* free resources attached to the cache */ void file_cache_free(struct filestr_cache *cachep) { - if (cachep && cachep->buffer) + if (cachep) { - dc_release_buffer(cachep->buffer); - cachep->buffer = NULL; + if(cachep->buffer) + { + dc_release_buffer(cachep->buffer); + cachep->buffer = NULL; + } + file_cache_reset(cachep); } - - file_cache_reset(cachep); } |