Skip to content

Commit

Permalink
If calloc() failed, ref() count would be out of balance.
Browse files Browse the repository at this point in the history
  • Loading branch information
mywave82 committed Sep 14, 2024
1 parent 01b06e2 commit ccd8169
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions filesel/filesystem-filehandle-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ struct ocpfilehandle_t *cache_filehandle_open (struct ocpfilehandle_t *parent)
1 /* refcount */
);

parent->origin->ref (parent->origin);

s->cache_line[0].data = calloc (1, CACHE_LINE_SIZE);
if (!s->cache_line[0].data)
{
Expand All @@ -122,7 +120,8 @@ struct ocpfilehandle_t *cache_filehandle_open (struct ocpfilehandle_t *parent)
}

s->parent = parent;
s->parent->ref (s->parent);
parent->ref (s->parent);
parent->origin->ref (parent->origin);

/* prefill cache-line 0 which is dedicated for the start of the file */

Expand Down

0 comments on commit ccd8169

Please sign in to comment.