ref: 692c020274499ffc952fe2cdf1aee27c364a4f91
parent: 2c1651bd5b23d04b203daf52801dd9b84bb9f6a9
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Feb 27 21:53:03 EST 2024
free buffers on send errors
--- a/9gc.c
+++ b/9gc.c
@@ -343,7 +343,11 @@
if((a = srv(chatsrv)) != NULL){
a->c.r = ctxchatR;
c9version(&a->c, &tag, Msize);
- wrsend(a);
+ if(wrsend(a) != 0){
+ free(a);
+ a = NULL;
+ continue;
+ }
return a;
}
// }else{
@@ -356,9 +360,13 @@
return NULL;
a->c.r = ctxregistryR;
c9version(&a->c, &tag, Msize);
- wrsend(a);
- while(c9proc(&a->c) == 0 && a->c.r == ctxregistryR)
- wrsend(a);
+ do{
+ if(wrsend(a) != 0){
+ free(a);
+ a = NULL;
+ break;
+ }
+ }while(c9proc(&a->c) == 0 && a->c.r == ctxregistryR);
return a;
}
@@ -474,7 +482,7 @@
for(;;){
if((a = registry()) == NULL)
return 1;
- while (chatrw(a) == 0 && wrsend(a) == 0);
+ while(chatrw(a) == 0 && wrsend(a) == 0);
if(a->flags & (Disconnected|Error)){
a->flags &= ~(Disconnected|Error);
skipuntil = chatoff;
--
⑨