Fix trivial memory leaks
Fixed trivial memory leaks detected by ASAN when running internal test suite.
This commit is contained in:
parent
26b2a4b15d
commit
8ef681d8cd
@ -33,6 +33,7 @@
|
||||
#include <maxscale/paths.h>
|
||||
#include <maxscale/log_manager.h>
|
||||
#include <maxscale/random_jkiss.h>
|
||||
#include <maxscale/alloc.h>
|
||||
|
||||
#include "internal/secrets.h"
|
||||
|
||||
@ -183,6 +184,7 @@ int main(int argc, char **argv)
|
||||
if (enc)
|
||||
{
|
||||
printf("%s\n", enc);
|
||||
MXS_FREE(enc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,11 +105,12 @@ SERVICE* service_alloc(const char *name, const char *router)
|
||||
SERVICE *service = (SERVICE *)MXS_CALLOC(1, sizeof(*service));
|
||||
SERVICE_REFRESH_RATE* rate_limits = (SERVICE_REFRESH_RATE*)MXS_CALLOC(config_threadcount(),
|
||||
sizeof(*rate_limits));
|
||||
if (!my_name || !my_router || !service)
|
||||
if (!my_name || !my_router || !service || !rate_limits)
|
||||
{
|
||||
MXS_FREE(my_name);
|
||||
MXS_FREE(my_router);
|
||||
MXS_FREE(service);
|
||||
MXS_FREE(rate_limits);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -131,6 +132,7 @@ SERVICE* service_alloc(const char *name, const char *router)
|
||||
MXS_FREE(my_name);
|
||||
MXS_FREE(my_router);
|
||||
MXS_FREE(service);
|
||||
MXS_FREE(rate_limits);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -845,5 +845,6 @@ int main(int argc, char **argv)
|
||||
mxs_log_finish();
|
||||
|
||||
MXS_FREE(inst);
|
||||
MXS_FREE(roptions);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user