diff options
author | lns <matzeton@googlemail.com> | 2022-04-24 23:49:57 +0200 |
---|---|---|
committer | lns <matzeton@googlemail.com> | 2022-04-24 23:49:57 +0200 |
commit | a46fc4153d0dd6b400c49a8f6d1e794f0d940ab7 (patch) | |
tree | cf67ab3e1cd672941f8d12ec19de11c2300d7254 /nDPIsrvd.c | |
parent | 22a8d04c748ff3e04ca11c5c29b4433c7136f5f5 (diff) |
nDPId: Merged nDPId_flow_(info|finished) into nDPId_flow
* nDPIsrvd: Fixed buffer allocation error due to missing memset() on disconnect
* nDPIsrvd: Removed unused struct members
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'nDPIsrvd.c')
-rw-r--r-- | nDPIsrvd.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/nDPIsrvd.c b/nDPIsrvd.c index 424419c9e..37894be88 100644 --- a/nDPIsrvd.c +++ b/nDPIsrvd.c @@ -41,7 +41,6 @@ struct remote_desc { struct { - int collector_sockfd; struct sockaddr_un peer; unsigned long long int json_bytes; pid_t pid; @@ -50,7 +49,6 @@ struct remote_desc } event_collector_un; struct { - int distributor_sockfd; struct sockaddr_un peer; pid_t pid; char * user_name; @@ -60,7 +58,6 @@ struct remote_desc } event_distributor_un; /* UNIX socket */ struct { - int distributor_sockfd; struct sockaddr_in peer; char peer_addr[INET_ADDRSTRLEN]; @@ -135,6 +132,7 @@ static void nDPIsrvd_buffer_array_dtor(void * elt) struct nDPIsrvd_write_buffer * const buf_dst = (struct nDPIsrvd_write_buffer *)elt; nDPIsrvd_buffer_free(&buf_dst->buf); + buf_dst->written = 0; } static const UT_icd nDPIsrvd_buffer_array_icd = {sizeof(struct nDPIsrvd_write_buffer), @@ -679,13 +677,10 @@ static void free_remote(int epollfd, struct remote_desc * remote) } if (remote->event_distributor_un.additional_write_buffers != NULL) { - utarray_clear(remote->event_distributor_un.additional_write_buffers); + utarray_free(remote->event_distributor_un.additional_write_buffers); } nDPIsrvd_buffer_free(&remote->event_distributor_un.main_write_buffer.buf); - remote->event_distributor_un.main_write_buffer.written = 0; - free(remote->event_distributor_un.user_name); - remote->event_distributor_un.user_name = NULL; break; case DISTRIBUTOR_IN: if (errno != 0) @@ -694,13 +689,13 @@ static void free_remote(int epollfd, struct remote_desc * remote) } if (remote->event_distributor_in.additional_write_buffers != NULL) { - utarray_clear(remote->event_distributor_in.additional_write_buffers); + utarray_free(remote->event_distributor_in.additional_write_buffers); } nDPIsrvd_buffer_free(&remote->event_distributor_in.main_write_buffer.buf); - remote->event_distributor_in.main_write_buffer.written = 0; break; } + memset(remote, 0, sizeof(*remote)); remote->fd = -1; remotes.desc_used--; } |