History

free buffers on send errors

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit 692c0201 parent 2c1651b1 file · +13 −5Browse files

Unified · Split

9gc.c+13−5
@@ -343,7 +343,11 @@ registry(void) · 342 unmodified lines
343343 if((a = srv(chatsrv)) != NULL){
344344 a->c.r = ctxchatR;
345345 c9version(&a->c, &tag, Msize);
346− wrsend(a);
346+ if(wrsend(a) != 0){
347+ free(a);
348+ a = NULL;
349+ continue;
350+ }
347351 return a;
348352 }
349353 // }else{
@@ -356,9 +360,13 @@ registry(void) · 6 unmodified lines
356360 return NULL;
357361 a->c.r = ctxregistryR;
358362 c9version(&a->c, &tag, Msize);
359− wrsend(a);
360− while(c9proc(&a->c) == 0 && a->c.r == ctxregistryR)
361− wrsend(a);
363+ do{
364+ if(wrsend(a) != 0){
365+ free(a);
366+ a = NULL;
367+ break;
368+ }
369+ }while(c9proc(&a->c) == 0 && a->c.r == ctxregistryR);
362370
363371 return a;
364372 }
@@ -474,7 +482,7 @@ main(int argc, char **argv) · 109 unmodified lines
474482 for(;;){
475483 if((a = registry()) == NULL)
476484 return 1;
477− while (chatrw(a) == 0 && wrsend(a) == 0);
485+ while(chatrw(a) == 0 && wrsend(a) == 0);
478486 if(a->flags & (Disconnected|Error)){
479487 a->flags &= ~(Disconnected|Error);
480488 skipuntil = chatoff;

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