comparison gdb_remote.c @ 1945:ba7231d2411c

Fix addrinfo leak in GDB remote debug support
author Michael Pavone <pavone@retrodev.com>
date Wed, 29 Apr 2020 01:00:15 -0700
parents 52a47611a273
children 5a76a7373823
comparison
equal deleted inserted replaced
1944:357878be8be6 1945:ba7231d2411c
586 fatal_error("Failed to open GDB remote debugging socket"); 586 fatal_error("Failed to open GDB remote debugging socket");
587 } 587 }
588 if (bind(listen_sock, result->ai_addr, result->ai_addrlen) < 0) { 588 if (bind(listen_sock, result->ai_addr, result->ai_addrlen) < 0) {
589 fatal_error("Failed to bind GDB remote debugging socket"); 589 fatal_error("Failed to bind GDB remote debugging socket");
590 } 590 }
591 freeaddrinfo(result);
591 if (listen(listen_sock, 1) < 0) { 592 if (listen(listen_sock, 1) < 0) {
592 fatal_error("Failed to listen on GDB remote debugging socket"); 593 fatal_error("Failed to listen on GDB remote debugging socket");
593 } 594 }
594 gdb_sock = accept(listen_sock, NULL, NULL); 595 gdb_sock = accept(listen_sock, NULL, NULL);
595 if (gdb_sock < 0) { 596 if (gdb_sock < 0) {