fix a dead wrong call to free(prof_time)

This commit is contained in:
Lephenixnoir 2020-07-20 20:22:09 +02:00
parent 8b074a4e58
commit 8a0bcfe903
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
2 changed files with 8 additions and 5 deletions

View file

@ -41,6 +41,6 @@ distclean: clean
# Install # Install
install: install: $(lib)
cp $(lib) $(DESTDIR)$(PREFIX) cp $(lib) $(DESTDIR)$(PREFIX)
cp $(header) $(DESTDIR)$(PREFIX)/include cp $(header) $(DESTDIR)$(PREFIX)/include

View file

@ -14,7 +14,7 @@ uint32_t *prof_elapsed = NULL;
/* Timer counter */ /* Timer counter */
uint32_t volatile *prof_tcnt = NULL; uint32_t volatile *prof_tcnt = NULL;
/* Timer ID */ /* Timer ID */
static int prof_timer; static int prof_timer = -1;
/* prof_init(): Initialize the profiler's data and timer */ /* prof_init(): Initialize the profiler's data and timer */
int prof_init(int context_count) int prof_init(int context_count)
@ -56,10 +56,13 @@ int prof_init(int context_count)
/* prof_quit(): Free the profiler's data and timer */ /* prof_quit(): Free the profiler's data and timer */
void prof_quit(void) void prof_quit(void)
{ {
timer_stop(prof_timer); if(prof_timer >= 0) timer_stop(prof_timer);
if(prof_rec) free(prof_rec);
if(prof_elapsed) free(prof_elapsed);
free(prof_rec); prof_timer = -1;
free(prof_time); prof_rec = NULL;
prof_elapsed = NULL;
} }
//--- //---