]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Resolve a file handle leak.
authorRussell Bryant <russell@russellbryant.com>
Tue, 26 May 2009 18:14:36 +0000 (18:14 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 26 May 2009 18:14:36 +0000 (18:14 +0000)
The frames here should have always been freed.  However, out of luck, there was
never any memory leaked.  However, after file streams became reference counted,
this code would leak the file stream for the file being read.

(closes issue #15181)
Reported by: jkroon

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

res/res_convert.c

index 7c4e04e8336972a95a0faeff97ad39196ababde4..8f76b2317e8e9f20d63594217d76823f3363584a 100644 (file)
@@ -100,9 +100,11 @@ static int cli_audio_convert_deprecated(int fd, int argc, char *argv[])
        
        while ((f = ast_readframe(fs_in))) {
                if (ast_writestream(fs_out, f)) {
+                       ast_frfree(f);
                        ast_cli(fd, "Failed to convert %s.%s to %s.%s!\n", name_in, ext_in, name_out, ext_out);
                        goto fail_out;
                }
+               ast_frfree(f);
        }
 
        cost = ast_tvdiff_ms(ast_tvnow(), start);
@@ -167,9 +169,11 @@ static int cli_audio_convert(int fd, int argc, char *argv[])
        
        while ((f = ast_readframe(fs_in))) {
                if (ast_writestream(fs_out, f)) {
+                       ast_frfree(f);
                        ast_cli(fd, "Failed to convert %s.%s to %s.%s!\n", name_in, ext_in, name_out, ext_out);
                        goto fail_out;
                }
+               ast_frfree(f);
        }
 
        cost = ast_tvdiff_ms(ast_tvnow(), start);