1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-09 12:44:11 +01:00

fix double deallocation in text back end

This commit is contained in:
q-posev 2021-12-23 18:49:00 +01:00
parent c2376bf168
commit 0a8aa638f6
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,3 @@
B
#+TITLE: Front end API
#+PROPERTY: comments org
#+SETUPFILE: ../../docs/theme.setup
@ -3551,7 +3550,7 @@ contains
end subroutine trexio_assert
#+end_src
* File suffixes :noexport:
#+begin_src c :tangle suffix_front.h
@ -3569,4 +3568,3 @@ contains
#+begin_src f90 :tangle suffix_fortran.f90
end module trexio
#+end_src

View File

@ -499,6 +499,12 @@ trexio_text_read_$group$ (trexio_text_t* const file)
// START REPEAT GROUP_DSET_STR
rc = fscanf(f, "%1023s", buffer);
assert(!((rc != 1) || (strcmp(buffer, "$group_dset$") != 0)));
if ((rc != 1) || (strcmp(buffer, "$group_dset$") != 0)) {
FREE(buffer);
fclose(f);
FREE($group$);
return NULL;
}
/* Allocate arrays */
if(size_$group_dset$ != 0) {
@ -528,7 +534,6 @@ trexio_text_read_$group$ (trexio_text_t* const file)
FREE(buffer);
fclose(f);
FREE($group$->$group_dset$);
FREE(tmp_$group_dset$);
FREE($group$);
return NULL;
}