Skip to content

Commit

Permalink
Fix a leak. Closes #591.
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Feb 28, 2024
1 parent 1dd1e55 commit a5217c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions blosc/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,15 @@ int frame_free(blosc2_frame_s *frame);
blosc2_frame_s* frame_from_file_offset(const char *urlpath, const blosc2_io *io_cb, int64_t offset);

/**
* @brief Initialize a frame out of a frame buffer.
* @brief Initialize a frame out of a contiguous frame buffer.
*
* @param buffer The buffer for the frame.
* @param cframe The buffer for the frame.
* @param len The length of buffer for the frame.
* @param copy Whether the frame buffer should be copied internally or not.
*
* @return The frame created from the frame buffer.
* @return The frame created from the contiguous frame buffer.
*
* @note The user is responsible to `free` the returned frame.
*/
blosc2_frame_s* frame_from_cframe(uint8_t *cframe, int64_t len, bool copy);

Expand Down
1 change: 1 addition & 0 deletions blosc/schunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ blosc2_schunk* blosc2_schunk_from_buffer(uint8_t *cframe, int64_t len, bool copy
char *magic_number = (char *)cframe;
magic_number += FRAME_HEADER_MAGIC;
if (strcmp(magic_number, "b2frame\0") != 0) {
frame_free(frame);
return NULL;
}
blosc2_schunk* schunk = frame_to_schunk(frame, copy, &BLOSC2_IO_DEFAULTS);
Expand Down

0 comments on commit a5217c2

Please sign in to comment.