[haiku-commits] haiku: hrev53355 - src/system/kernel/fs

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 8 Aug 2019 23:36:32 -0400 (EDT)

hrev53355 adds 1 changeset to branch 'master'
old head: b711002d345e2e9e0075be46a37492624f73ccdd
new head: 6a231205031579ee52202ac8ec74f5d891ef0d1f
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=6a2312050315+%5Eb711002d345e

----------------------------------------------------------------------------

6a2312050315: kernel/fs: Fix another instance of free() being called on a FD.
  
  Fixes the second panic in #15213.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53355
Commit:      6a231205031579ee52202ac8ec74f5d891ef0d1f
URL:         https://git.haiku-os.org/haiku/commit/?id=6a2312050315
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Aug  9 03:34:40 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/15213

----------------------------------------------------------------------------

1 file changed, 4 insertions(+), 2 deletions(-)
src/system/kernel/fs/socket.cpp | 6 ++++--

----------------------------------------------------------------------------

diff --git a/src/system/kernel/fs/socket.cpp b/src/system/kernel/fs/socket.cpp
index e62ef60bda..bbe0dd880f 100644
--- a/src/system/kernel/fs/socket.cpp
+++ b/src/system/kernel/fs/socket.cpp
@@ -361,8 +361,10 @@ create_socket_fd(net_socket* socket, bool kernel)
 
        // publish it
        int fd = new_fd(get_current_io_context(kernel), descriptor);
-       if (fd < 0)
-               free(descriptor);
+       if (fd < 0) {
+               descriptor->ops = NULL;
+               put_fd(descriptor);
+       }
 
        return fd;
 }


Other related posts:

  • » [haiku-commits] haiku: hrev53355 - src/system/kernel/fs - waddlesplash