In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a1684041ccc6694387ef0636ae2c29f4bd7626c8?hp=3147e83bb9692573356e676668be17d48f48828c>

- Log -----------------------------------------------------------------
commit a1684041ccc6694387ef0636ae2c29f4bd7626c8
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed Jan 7 20:12:51 2015 -0500

    [-Dusecbacktrace] Close the BFD descriptor.
    
    Otherwise we leak several dozens of megabytes, if not more,
    for each Perl_dump_c_backtrace().
-----------------------------------------------------------------------

Summary of changes:
 util.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/util.c b/util.c
index 7efc986..67136fe 100644
--- a/util.c
+++ b/util.c
@@ -5835,6 +5835,9 @@ static void bfd_update(bfd_context* ctx, Dl_info* dl_info)
     /* BFD open and scan only if the filename changed. */
     if (ctx->fname_prev == NULL ||
         strNE(dl_info->dli_fname, ctx->fname_prev)) {
+        if (ctx->abfd) {
+            bfd_close(ctx->abfd);
+        }
         ctx->abfd = bfd_openr(dl_info->dli_fname, 0);
         if (ctx->abfd) {
             if (bfd_check_format(ctx->abfd, bfd_object)) {
@@ -6331,6 +6334,9 @@ Perl_get_c_backtrace(pTHX_ int depth, int skip)
     }
 #ifdef USE_BFD
     Safefree(symbol_names);
+    if (bfd_ctx.abfd) {
+        bfd_close(bfd_ctx.abfd);
+    }
 #endif
     Safefree(source_lines);
     Safefree(source_name_sizes);

--
Perl5 Master Repository

Reply via email to