History

9gc: fix socket leak

Sigrid Solveig Haflínudóttir committed 4 years ago

Commit 961ec701 parent d93d3851 file · +4 −5Browse files

Unified · Split

9gc.c+4−5
@@ -146,11 +146,10 @@ dial(char *s) · 145 unmodified lines
146 for (a = r; a != NULL; a = a->ai_next) {146 for (a = r; a != NULL; a = a->ai_next) {
147 if ((f = socket(a->ai_family, a->ai_socktype, a->ai_protocol)) < 0)147 if ((f = socket(a->ai_family, a->ai_socktype, a->ai_protocol)) < 0)
148 continue;148 continue;
149 if (connect(f, a->ai_addr, a->ai_addrlen) != 0) {149 if (connect(f, a->ai_addr, a->ai_addrlen) == 0)
150 close(f);150 break;
151 f = -1;151 close(f);
152 continue;152 f = -1;
153 }
154 }153 }
155 freeaddrinfo(r);154 freeaddrinfo(r);
156 155

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t