syncthing / syncthing

Issues with cancel func returned by context.WithCancel VET-V0011
Bug risk
Major
2 occurrences in this check
the aggrCancel function is not used on all paths (possible context leak)
1000			}
1001			aggrCancel()
1002			errChan = nil
1003			aggrCtx, aggrCancel = context.WithCancel(ctx)1004		case <-ctx.Done():
1005			return
1006		}
this return statement may be reached without using the aggrCancel var defined on line 1003
1002			errChan = nil
1003			aggrCtx, aggrCancel = context.WithCancel(ctx)
1004		case <-ctx.Done():
1005			return1006		}
1007	}
1008}