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 | |
parent | 6de6e1459de28bef919b869ee757474c615cb787 (diff) | |
download | rockbox-2df306923a2b09aa6e46a3e24e9b0335c8016a1d.tar.gz rockbox-2df306923a2b09aa6e46a3e24e9b0335c8016a1d.zip |
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
-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) | |||
75 | /* free resources attached to the cache */ | 75 | /* free resources attached to the cache */ |
76 | void file_cache_free(struct filestr_cache *cachep) | 76 | void file_cache_free(struct filestr_cache *cachep) |
77 | { | 77 | { |
78 | if (cachep && cachep->buffer) | 78 | if (cachep) |
79 | { | 79 | { |
80 | dc_release_buffer(cachep->buffer); | 80 | if(cachep->buffer) |
81 | cachep->buffer = NULL; | 81 | { |
82 | dc_release_buffer(cachep->buffer); | ||
83 | cachep->buffer = NULL; | ||
84 | } | ||
85 | file_cache_reset(cachep); | ||
82 | } | 86 | } |
83 | |||
84 | file_cache_reset(cachep); | ||
85 | } | 87 | } |
86 | 88 | ||
87 | 89 | ||