]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix improbable but possible memory leaks in chan_zap.
authorJoshua Colp <jcolp@digium.com>
Tue, 6 Nov 2007 16:24:56 +0000 (16:24 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 6 Nov 2007 16:24:56 +0000 (16:24 +0000)
(closes issue #11166)
Reported by: eliel
Patches:
      chan_zap.c.patch uploaded by eliel (license 64)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@88994 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c

index d694fd0a33cd8b47f705b2c8ff5fea5957848f8b..11165ae046a0e2a89fd38b7b446dd1001c5675c3 100644 (file)
@@ -905,7 +905,13 @@ static int zt_open(char *fn)
                }
        }
        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 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
                        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;