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
This commit is contained in:
William Wilgus 2021-08-13 06:32:44 -04:00
parent 6de6e1459d
commit 2df306923a

View file

@ -75,13 +75,15 @@ void file_cache_alloc(struct filestr_cache *cachep)
/* free resources attached to the cache */ /* free resources attached to the cache */
void file_cache_free(struct filestr_cache *cachep) void file_cache_free(struct filestr_cache *cachep)
{ {
if (cachep && cachep->buffer) if (cachep)
{ {
dc_release_buffer(cachep->buffer); if(cachep->buffer)
cachep->buffer = NULL; {
dc_release_buffer(cachep->buffer);
cachep->buffer = NULL;
}
file_cache_reset(cachep);
} }
file_cache_reset(cachep);
} }