]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 370430,370432 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Tue, 24 Jul 2012 17:24:51 +0000 (17:24 +0000)
committerAutomerge script <automerge@asterisk.org>
Tue, 24 Jul 2012 17:24:51 +0000 (17:24 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r370430 | kpfleming | 2012-07-24 11:54:01 -0500 (Tue, 24 Jul 2012) | 5 lines

  Rewrite a comment that didn't adequately explain the code it was documenting.
  ........

  Merged revisions 370429 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................
  r370432 | tzafrir | 2012-07-24 12:08:40 -0500 (Tue, 24 Jul 2012) | 4 lines

  chan_oss: fix "sample rate" error message

  Merged revisions 370428 from http://svn.asterisk.org/svn/asterisk/branches/1.8
................

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

channels/chan_oss.c
main/frame.c

index 17894ab6fb2a886b5291b4a8d4461868763f7ef0..d78ef5a105d81581b4c7700d5712bb38852b1006 100644 (file)
@@ -531,7 +531,7 @@ static int setformat(struct chan_oss_pvt *o, int mode)
        res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);
 
        if (res < 0) {
-               ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
+               ast_log(LOG_WARNING, "Failed to set sample rate to %d\n", desired);
                return -1;
        }
        if (fmt != desired) {
index b3ee6412df03ac8419b3cccde6308dd4884a0b08..4ac29a6cfb597d966097733d12475ced8b5c5dc1 100644 (file)
@@ -491,13 +491,18 @@ struct ast_frame *ast_frdup(const struct ast_frame *f)
        out->datalen = f->datalen;
        out->samples = f->samples;
        out->delivery = f->delivery;
-       /* Set us as having malloc'd header only, so it will eventually
-          get freed. */
+       /* Even though this new frame was allocated from the heap, we can't mark it
+        * with AST_MALLOCD_HDR, AST_MALLOCD_DATA and AST_MALLOCD_SRC, because that
+        * would cause ast_frfree() to attempt to individually free each of those
+        * under the assumption that they were separately allocated. Since this frame
+        * was allocated in a single allocation, we'll only mark it as if the header
+        * was heap-allocated; this will result in the entire frame being properly freed.
+        */
        out->mallocd = AST_MALLOCD_HDR;
        out->offset = AST_FRIENDLY_OFFSET;
        if (out->datalen) {
                out->data.ptr = buf + sizeof(*out) + AST_FRIENDLY_OFFSET;
-               memcpy(out->data.ptr, f->data.ptr, out->datalen);       
+               memcpy(out->data.ptr, f->data.ptr, out->datalen);
        } else {
                out->data.uint32 = f->data.uint32;
        }