Fortify error-cases
We don't want to play with our luck here.
This commit is contained in:
parent
390b5855f5
commit
8001703f50
1 changed files with 3 additions and 3 deletions
6
quark.c
6
quark.c
|
@ -95,7 +95,7 @@ static char reqbuf[MAXBUFLEN+1];
|
||||||
static char resbuf[MAXBUFLEN+1];
|
static char resbuf[MAXBUFLEN+1];
|
||||||
static char reqhost[256];
|
static char reqhost[256];
|
||||||
static char reqmod[256];
|
static char reqmod[256];
|
||||||
static int fd;
|
static int fd = -1;
|
||||||
static Request req;
|
static Request req;
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -504,7 +504,7 @@ sighandler(int sig) {
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
struct addrinfo hints, *ai;
|
struct addrinfo hints, *ai = NULL;
|
||||||
struct passwd *upwd;
|
struct passwd *upwd;
|
||||||
struct group *gpwd;
|
struct group *gpwd;
|
||||||
int i;
|
int i;
|
||||||
|
@ -595,7 +595,7 @@ main(int argc, char *argv[]) {
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
err:
|
err:
|
||||||
if (fd)
|
if (fd != -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
if (ai)
|
if (ai)
|
||||||
freeaddrinfo(ai);
|
freeaddrinfo(ai);
|
||||||
|
|
Loading…
Reference in a new issue