[asterisk-commits] file: branch 1.4 r88994 - /branches/1.4/channels/chan_zap.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 6 10:24:57 CST 2007


Author: file
Date: Tue Nov  6 10:24:56 2007
New Revision: 88994

URL: http://svn.digium.com/view/asterisk?view=rev&rev=88994
Log:
Fix improbable but possible memory leaks in chan_zap.
(closes issue #11166)
Reported by: eliel
Patches:
      chan_zap.c.patch uploaded by eliel (license 64)

Modified:
    branches/1.4/channels/chan_zap.c

Modified: branches/1.4/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_zap.c?view=diff&rev=88994&r1=88993&r2=88994
==============================================================================
--- branches/1.4/channels/chan_zap.c (original)
+++ branches/1.4/channels/chan_zap.c Tue Nov  6 10:24:56 2007
@@ -905,7 +905,13 @@
 		}
 	}
 	bs = READ_SIZE;
-	if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs) == -1) return -1;
+	if (ioctl(fd, ZT_SET_BLOCKSIZE, &bs) == -1) {
+		ast_log(LOG_WARNING, "Unable to set blocksize '%d': %s\n", bs,  strerror(errno));
+		x = errno;
+		close(fd);
+		errno = x;
+		return -1;
+	}
 	return fd;
 }
 
@@ -11406,8 +11412,10 @@
 			continue;
 		}
 		  /* if got exception */
-		if (fds[0].revents & POLLPRI)
+		if (fds[0].revents & POLLPRI) {
+			ast_free(mybuf);
 			return -1;
+		}
 		if (!(fds[0].revents & POLLOUT)) {
 			ast_log(LOG_DEBUG, "write fd not ready on channel %d\n", p->channel);
 			continue;




More information about the asterisk-commits mailing list