FrancescAlted/caterva

Possible leak at caterva_blosc_array_empty()

oscargm98 opened this issue · 1 comments

valg

When I run caterva_blosc_append(), valgrind warns me about a leak in blosc2_new_frame(). It seems lthat the created frame is not freed:

Leak_DefinitelyLost
frame.c
232 (48 direct, 184 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
malloc
blosc2_new_frame
caterva_blosc_array_empty
caterva_array_empty

/* Create a new (empty) frame /
blosc2_frame
blosc2_new_frame(const char* fname) {
blosc2_frame* new_frame = malloc(sizeof(blosc2_frame)); // PROBLEM LINE
memset(new_frame, 0, sizeof(blosc2_frame));
if (fname != NULL) {
char* new_fname = malloc(strlen(fname) + 1); // + 1 for the trailing NULL
new_frame->fname = strcpy(new_fname, fname);
}

Outdated!