summaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2016-06-14 14:01:12 +0200
committerRichard Braun <rbraun@sceen.net>2016-06-14 14:03:42 +0200
commitbc170131016969f1d79409337833046ae1f4501b (patch)
treebf437849d71ca6811d05f408cfb44e9d683d5d1a /pfinet
parentd024ec32b8fbeb039078388d5d3d699a821cfb14 (diff)
pfinet: fix memory leak
* pfinet/socket-ops.c (S_socket_recv): Unmap data on error.
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/socket-ops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pfinet/socket-ops.c b/pfinet/socket-ops.c
index 14b3120c..c7686026 100644
--- a/pfinet/socket-ops.c
+++ b/pfinet/socket-ops.c
@@ -521,7 +521,11 @@ S_socket_recv (struct sock_user *user,
pthread_mutex_unlock (&global_lock);
if (err < 0)
- err = -err;
+ {
+ err = -err;
+ if (alloced)
+ munmap (*data, amount);
+ }
else
{
*datalen = err;