From 14ec9965adfbb88f17606604a50ae33a18ceb62b Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Tue, 6 Dec 2011 20:58:41 +0100 Subject: erts: Small fix in inet_drv.c:sctp_set_opts --- erts/emulator/drivers/common/inet_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index e0d869f328..80b2add939 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -6189,7 +6189,7 @@ static int sctp_set_opts(inet_descriptor* desc, char* ptr, int len) proto = IPPROTO_SCTP; type = SCTP_DELAYED_ACK_TIME; arg_ptr = (char*) (&arg.av); - arg_sz = sizeof ( arg.es); + arg_sz = sizeof ( arg.av); break; } # endif -- cgit v1.2.3 From fd73fcc88fb6ae8a034a40744906a7c945423b3e Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 7 Dec 2011 15:11:08 +0100 Subject: erts: Fix memory leak in test drivers --- erts/emulator/test/driver_SUITE_data/monitor_drv.c | 3 ++- erts/emulator/test/driver_SUITE_data/thr_free_drv.c | 2 +- erts/emulator/test/driver_SUITE_data/timer_drv.c | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erts/emulator/test/driver_SUITE_data/monitor_drv.c b/erts/emulator/test/driver_SUITE_data/monitor_drv.c index 1da6a56a72..ffb6ae9085 100644 --- a/erts/emulator/test/driver_SUITE_data/monitor_drv.c +++ b/erts/emulator/test/driver_SUITE_data/monitor_drv.c @@ -21,6 +21,7 @@ #include "erl_driver.h" static ErlDrvData monitor_drv_start(ErlDrvPort, char *); +static void monitor_drv_stop(ErlDrvData data); static int monitor_drv_control(ErlDrvData, unsigned int, char *, int, char **, int); static void handle_monitor(ErlDrvData drv_data, ErlDrvMonitor *monitor); @@ -50,7 +51,7 @@ typedef struct { static ErlDrvEntry monitor_drv_entry = { NULL /* init */, monitor_drv_start, - NULL /* stop */, + monitor_drv_stop, NULL /* output */, NULL /* ready_input */, NULL /* ready_output */, diff --git a/erts/emulator/test/driver_SUITE_data/thr_free_drv.c b/erts/emulator/test/driver_SUITE_data/thr_free_drv.c index 622a62ebea..40637c946c 100644 --- a/erts/emulator/test/driver_SUITE_data/thr_free_drv.c +++ b/erts/emulator/test/driver_SUITE_data/thr_free_drv.c @@ -175,7 +175,7 @@ fail: driver_free(ttd[t].blocks[b]); } } - + driver_free(td); return ERL_DRV_ERROR_GENERAL; } diff --git a/erts/emulator/test/driver_SUITE_data/timer_drv.c b/erts/emulator/test/driver_SUITE_data/timer_drv.c index b96a95dd4c..3ea37fa079 100644 --- a/erts/emulator/test/driver_SUITE_data/timer_drv.c +++ b/erts/emulator/test/driver_SUITE_data/timer_drv.c @@ -22,7 +22,9 @@ static ErlDrvPort erlang_port; static ErlDrvData timer_start(ErlDrvPort, char*); -static void timer_stop(ErlDrvData), timer_read(ErlDrvData, char*, int), timer(ErlDrvData); +static void timer_stop(ErlDrvData); +static void timer_read(ErlDrvData, char*, int); +static void timer(ErlDrvData); static ErlDrvEntry timer_driver_entry = { -- cgit v1.2.3 From ea93ca94a8a73d5e3f27f6a23cdb82870ab66da8 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 7 Dec 2011 17:08:16 +0100 Subject: erts: Suppress valgrind warning about syscall sendmsg Valgrind complains: "Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)". Seems valgrind do not know which bytes of msg_control are padding. --- erts/emulator/drivers/common/inet_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index 80b2add939..8ddba39243 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -539,6 +539,13 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n) (((unsigned char*) (s))[1] << 8) | \ (((unsigned char*) (s))[0])) + +#ifdef VALGRIND +# include +#else +# define VALGRIND_MAKE_MEM_DEFINED(ptr,size) +#endif + /*---------------------------------------------------------------------------- ** Interface constants. ** @@ -10238,6 +10245,7 @@ static void packet_inet_command(ErlDrvData e, char* buf, int len) cmsg.hdr.cmsg_level = IPPROTO_SCTP; cmsg.hdr.cmsg_type = SCTP_SNDRCV; cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(*sri)); + VALGRIND_MAKE_MEM_DEFINED(&cmsg, (char*)sri - (char*)&cmsg); /*suppress padding as "uninitialised bytes"*/ data_len = (buf + len) - ptr; /* The whole msg. -- cgit v1.2.3