Avoids leaking memory when exiting early.
Signed-off by: Rosen <rosenp@gmail.com>
strcpy(path, dir);
strcat(path, "*");
- if (scan_loaded_modules())
+ if (scan_loaded_modules()) {
+ free (path);
return -1;
+ }
- if (scan_module_folders())
+ if (scan_module_folders()) {
+ free (path);
return -1;
+ }
syslog(LOG_INFO, "kmodloader: loading kernel modules from %s\n", path);
struct blob_attr *msg)
{
struct client *cl;
- struct blob_attr *tb[__READ_MAX];
+ struct blob_attr *tb[__READ_MAX] = { 0 };
struct log_head *l;
int count = 0;
int fds[2];
char *p, *str = strdup(s->value);
const char *value = s->value;
- if (!str || !nargs)
+ if (!str || !nargs) {
+ free(str);
return false;
+ }
for (p = strtok(str, " \t"); p; p = strtok(NULL, " \t"))
{