aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/nifs/common/socket_int.h
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-12-06 12:40:37 +0100
committerMicael Karlberg <[email protected]>2018-12-06 12:44:44 +0100
commit7923c2c7ce4deba75d845501eb96ddce07dc5ea0 (patch)
tree388b9f6a5a42182cbaf9c81dbda5be6fa94d819f /erts/emulator/nifs/common/socket_int.h
parenta862cc8ab56616e182c959a5a6a06e4aefa09b08 (diff)
downloadotp-7923c2c7ce4deba75d845501eb96ddce07dc5ea0.tar.gz
otp-7923c2c7ce4deba75d845501eb96ddce07dc5ea0.tar.bz2
otp-7923c2c7ce4deba75d845501eb96ddce07dc5ea0.zip
[socket-nif] Valgrind: plugged memory leaks in nif_recv
Running valgrind, found a couple of cases when allocated binaries where not released. Mostly when the recv failed for some reason. Also clear and free the environment associated with the socket (resource) (in the _dtor callback function). OTP-14831
Diffstat (limited to 'erts/emulator/nifs/common/socket_int.h')
-rw-r--r--erts/emulator/nifs/common/socket_int.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/erts/emulator/nifs/common/socket_int.h b/erts/emulator/nifs/common/socket_int.h
index 7d223b8259..ec17e45f25 100644
--- a/erts/emulator/nifs/common/socket_int.h
+++ b/erts/emulator/nifs/common/socket_int.h
@@ -378,6 +378,7 @@ extern ERL_NIF_TERM esock_atom_einval;
#define ALLOC_BIN(SZ, BP) enif_alloc_binary((SZ), (BP))
#define REALLOC_BIN(SZ, BP) enif_realloc_binary((SZ), (BP))
+#define FREE_BIN(BP) enif_release_binary((BP))
#endif // SOCKET_INT_H__