[sr-dev] git:master:dadd54a4: xmpp: close fd in case of write error

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 20 09:32:12 CEST 2017


Module: kamailio
Branch: master
Commit: dadd54a46f81ef05478e622a89a3bb739907cade
URL: https://github.com/kamailio/kamailio/commit/dadd54a46f81ef05478e622a89a3bb739907cade

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-20T09:31:49+02:00

xmpp: close fd in case of write error

---

Modified: src/modules/xmpp/xode_from.c

---

Diff:  https://github.com/kamailio/kamailio/commit/dadd54a46f81ef05478e622a89a3bb739907cade.diff
Patch: https://github.com/kamailio/kamailio/commit/dadd54a46f81ef05478e622a89a3bb739907cade.patch

---

diff --git a/src/modules/xmpp/xode_from.c b/src/modules/xmpp/xode_from.c
index f2d9b54569..8a78f4ba4d 100644
--- a/src/modules/xmpp/xode_from.c
+++ b/src/modules/xmpp/xode_from.c
@@ -225,8 +225,10 @@ int xode_to_file(char *file, xode node)
 
     doc = xode_to_str(node);
     i = write(fd,doc,strlen(doc));
-    if(i < 0)
+    if(i < 0) {
+        close(fd);
         return -1;
+    }
 
     close(fd);
     return 1;




More information about the sr-dev mailing list