Fix memory leak in DbDelete()

This commit is contained in:
Jordan Bancino 2022-12-28 15:44:21 +00:00
parent 1a43ea6470
commit fbd7bf5944
3 changed files with 12 additions and 7 deletions

View file

@ -1,4 +1,4 @@
.Dd $Mdocdate: December 24 2022 $
.Dd $Mdocdate: December 28 2022 $
.Dt TELODENDRIA-CHANGELOG 7
.Os Telodendria Project
.Sh NAME
@ -101,6 +101,9 @@ safer ones.
.It
Fixed a memory leak that would occur when closing a
database that contains cached objects.
.It
Fixed a memory leak that would occur when deleting database
objects.
.El
.Pp
Misc:

View file

@ -47,7 +47,7 @@ typedef struct Job
} Job;
static Job *
JobCreate(long interval, JobFunc *func, void *args)
JobCreate(long interval, JobFunc * func, void *args)
{
Job *job;
@ -111,9 +111,9 @@ CronThread(void *args)
const unsigned long microTick = 100;
unsigned long remainingTick = cron->tick - (te - ts);
/* Only sleep for microTick ms at a time because if the
* job scheduler is supposed to stop before the tick is up,
* we don't want to be stuck in a long sleep */
/* Only sleep for microTick ms at a time because if the job
* scheduler is supposed to stop before the tick is up, we
* don't want to be stuck in a long sleep */
while (remainingTick >= microTick && !cron->stop)
{
UtilSleepMillis(microTick);
@ -156,7 +156,7 @@ CronCreate(unsigned long tick)
}
void
CronOnce(Cron * cron, JobFunc *func, void *args)
CronOnce(Cron * cron, JobFunc * func, void *args)
{
Job *job;
@ -177,7 +177,7 @@ void
}
void
CronEvery(Cron * cron, unsigned long interval, JobFunc *func, void *args)
CronEvery(Cron * cron, unsigned long interval, JobFunc * func, void *args)
{
Job *job;

View file

@ -662,6 +662,8 @@ DbDelete(Db * db, size_t nArgs,...)
pthread_mutex_unlock(&db->lock);
ArrayFree(args);
Free(file);
return ret;
}