diff --git a/src/necronda-server.cpp b/src/necronda-server.cpp index 5006180..9a895c4 100644 --- a/src/necronda-server.cpp +++ b/src/necronda-server.cpp @@ -195,7 +195,7 @@ string read_line(FILE* file) { char *line = nullptr; size_t len = 0; ssize_t read; - if ((read = getline(&line, &len, file)) < 0) { + if ((read = getline(&line, &len, file)) < 0 || line == nullptr) { return ""; } string l = string(line); diff --git a/src/network/Socket.cpp b/src/network/Socket.cpp index be0a4ce..fbf51f1 100644 --- a/src/network/Socket.cpp +++ b/src/network/Socket.cpp @@ -576,7 +576,7 @@ long Socket::select(list read, list write, long millis) { FD_SET(s.fd, &writefd); } - struct timeval *tv; + struct timeval *tv = new struct timeval; if (millis < 0) { tv = nullptr; } else if (millis == 0) {