summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2010-06-28 02:39:03 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-06-28 02:39:03 +0200
commit36524df36189e8c4f18501362f9e55ce3c55b421 (patch)
tree258f949c125f1ba48b85afc6b39e57a4b1aecc28
parent99dd898a59d5316dccbb00294305e7eeba3ad8d8 (diff)
Fix memory leak on receive error
* pfinet/io-ops.c (S_io_read): On error, free data array if it was allocated.
-rw-r--r--pfinet/io-ops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c
index 21bc3ac2..bee1c19a 100644
--- a/pfinet/io-ops.c
+++ b/pfinet/io-ops.c
@@ -102,7 +102,11 @@ S_io_read (struct sock_user *user,
__mutex_unlock (&global_lock);
if (err < 0)
- err = -err;
+ {
+ err = -err;
+ if (alloced)
+ munmap (*data, amount);
+ }
else
{
*datalen = err;