mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-03 00:13:42 +00:00
Replace unchecked malloc with ss_malloc.
In a few places `malloc` was being used without checking the return for a `NULL` pointer. There's already a wrapper (`ss_malloc`) in `util.c` that performs this check and exits if it fails so this commit replaces the unsafe `malloc`s with `ss_malloc`s.
This commit is contained in:
+1
-1
@@ -612,7 +612,7 @@ void setTosFromConnmark(remote_t* remote, server_t* server)
|
||||
struct sockaddr_storage from_addr;
|
||||
len = sizeof from_addr;
|
||||
if(getpeername(remote->fd, (struct sockaddr*)&from_addr, &len) == 0) {
|
||||
if((server->tracker = (struct dscptracker*) malloc(sizeof(struct dscptracker))))
|
||||
if((server->tracker = (struct dscptracker*) ss_malloc(sizeof(struct dscptracker))))
|
||||
{
|
||||
if ((server->tracker->ct = nfct_new())) {
|
||||
// Build conntrack query SELECT
|
||||
|
||||
Reference in New Issue
Block a user