Fix some memory leaks, found by Valgrind
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
parent
8c0304a977
commit
1236334c39
@ -779,6 +779,7 @@ static int *create_inet_sockets(void)
|
|||||||
socks = malloc((maxs + 1) * sizeof(int));
|
socks = malloc((maxs + 1) * sizeof(int));
|
||||||
if (!socks) {
|
if (!socks) {
|
||||||
logerror("couldn't allocate memory for sockets");
|
logerror("couldn't allocate memory for sockets");
|
||||||
|
freeaddrinfo(res);
|
||||||
die(0);
|
die(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -832,13 +833,14 @@ static int *create_inet_sockets(void)
|
|||||||
(*socks)++;
|
(*socks)++;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
if (res)
|
freeaddrinfo(res);
|
||||||
freeaddrinfo(res);
|
|
||||||
if (*socks == 0) {
|
if (*socks == 0) {
|
||||||
logerror("no valid sockets, suspending inet");
|
logerror("no valid sockets, suspending inet");
|
||||||
free(socks);
|
free(socks);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return socks;
|
return socks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2262,6 +2264,9 @@ void die(int signo)
|
|||||||
(void)unlink(funixn[i]);
|
(void)unlink(funixn[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parts)
|
||||||
|
free(parts);
|
||||||
|
|
||||||
(void)remove_pid(PidFile);
|
(void)remove_pid(PidFile);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -2337,8 +2342,10 @@ void init(void)
|
|||||||
case F_PIPE:
|
case F_PIPE:
|
||||||
case F_TTY:
|
case F_TTY:
|
||||||
case F_CONSOLE:
|
case F_CONSOLE:
|
||||||
(void)close(f->f_file);
|
if (f->f_file >= 0)
|
||||||
|
(void)close(f->f_file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_FORW:
|
case F_FORW:
|
||||||
case F_FORW_SUSP:
|
case F_FORW_SUSP:
|
||||||
freeaddrinfo(f->f_un.f_forw.f_addr);
|
freeaddrinfo(f->f_un.f_forw.f_addr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user