]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix the last couple of places where free() was improperly used directly.
authorRussell Bryant <russell@russellbryant.com>
Wed, 7 Jan 2009 22:35:36 +0000 (22:35 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 7 Jan 2009 22:35:36 +0000 (22:35 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@167566 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/file.c

index 8878fae1b278d160987eebf84c4f432fa4aee0ec..5836e21e3646f77425887e3a927b62ea0f49b46d 100644 (file)
@@ -969,11 +969,11 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons
                if (!bfile || (fs = get_filestream(f, bfile)) == NULL ||
                    open_wrapper(fs) ) {
                        ast_log(LOG_WARNING, "Unable to open %s\n", fn);
-                       if (fs)
-                               ast_free(fs);
+                       if (fs) {
+                               ast_closestream(fs);
+                       }
                        fs = NULL;
-                       if (bfile)
-                               fclose(bfile);
+                       bfile = NULL;
                        free(fn);
                        continue;
                }
@@ -1086,9 +1086,10 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con
                                        unlink(fn);
                                        unlink(orig_fn);
                                }
-                               if (fs)
-                                       ast_free(fs);
-                               fs = NULL;
+                               if (fs) {
+                                       ast_closestream(fs);
+                                       fs = NULL;
+                               }
                                continue;
                        }
                        fs->trans = NULL;