Ticket #10229: resleak-702031.patch

File resleak-702031.patch, 1.3 KB (added by Ezodev, 10 years ago)
  • src/apps/terminal/Shell.cpp

    From cb074b2119b640a85f3eb29de377b7d6167c4187 Mon Sep 17 00:00:00 2001
    From: Ezo <ezo.dev@gmail.com>
    Date: Fri, 22 Nov 2013 17:24:21 +0000
    Subject: [PATCH] Fixed Resource Leak CID:702031
    
    ---
     src/apps/terminal/Shell.cpp | 6 ++----
     1 file changed, 2 insertions(+), 4 deletions(-)
    
    diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp
    index ebfe8f2..4ddbb25 100644
    a b Shell::_Spawn(int row, int col, const ShellParameters& parameters)  
    432432        fprintf(stderr, "Failed to init pseudo tty.");
    433433        return errno;
    434434    }
     435   
     436    close(master);
    435437
    436438    /*
    437439     * Get the modes of the current terminal. We will duplicates these
    Shell::_Spawn(int row, int col, const ShellParameters& parameters)  
    443445    /* Fork a child process. */
    444446    fShellInfo.SetProcessID(fork());
    445447    if (fShellInfo.ProcessID() < 0) {
    446         close(master);
    447448        return B_ERROR;
    448449    }
    449450
    Shell::_Spawn(int row, int col, const ShellParameters& parameters)  
    452453    if (fShellInfo.ProcessID() == 0) {
    453454        // Now in child process.
    454455
    455         // close the PTY master side
    456         close(master);
    457 
    458456        /*
    459457         * Make our controlling tty the pseudo tty. This hapens because
    460458         * we cleared our original controlling terminal above.