diff options
author | Thomas White <taw@physics.org> | 2023-09-23 11:18:41 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-09-23 11:18:41 +0200 |
commit | 2eec8d1846bb29bf753a34aefaebd301ef17de03 (patch) | |
tree | d8ffa3b0751c163a9e0dce9c611a6053aec5a957 /libcrystfel | |
parent | 9f9722f2fc2c24fa0d4df4cb9f1f788acb2cd0c8 (diff) |
Fix a couple of profiling memory errors
The "children" array was the wrong size, and not freed. Also, some
formatting fussiness.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/profile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libcrystfel/src/profile.c b/libcrystfel/src/profile.c index 75983af3..ac76b8fa 100644 --- a/libcrystfel/src/profile.c +++ b/libcrystfel/src/profile.c @@ -168,6 +168,7 @@ static void free_profile_block(struct _profile_block *b) for ( i=0; i<b->n_children; i++ ) { free_profile_block(b->children[i]); } + free(b->children); free(b->name); free(b); } @@ -217,9 +218,10 @@ void profile_start(const char *name) if ( pd->current->n_children >= pd->current->max_children ) { struct _profile_block **nblock; int nmax = pd->current->n_children + 64; - nblock = realloc(pd->current->children, nmax*sizeof(struct _profile_block)); + nblock = realloc(pd->current->children, nmax*sizeof(struct _profile_block *)); if ( nblock == NULL ) { - fprintf(stderr, "Failed to allocate profiling record. Try again without --profile.\n"); + fprintf(stderr, "Failed to allocate profiling record. " + "Try again without --profile.\n"); abort(); } pd->current->children = nblock; |