Skip to content

Commit e8cbcaf

Browse files
FreddieAkeroydmdavidsaver
authored andcommitted
Check socket is valid before destroy
1 parent 7cbc2f6 commit e8cbcaf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

client/castApp/src/caster.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,12 @@ void casterShutdown(caster_t *self)
144144

145145
epicsEventDestroy(self->shutdownEvent);
146146
self->shutdownEvent = NULL;
147-
epicsSocketDestroy(self->wakeup[0]);
148-
epicsSocketDestroy(self->wakeup[1]);
149-
147+
if (self->wakeup[0] != INVALID_SOCKET) {
148+
epicsSocketDestroy(self->wakeup[0]);
149+
}
150+
if (self->wakeup[1] != INVALID_SOCKET) {
151+
epicsSocketDestroy(self->wakeup[1]);
152+
}
150153
epicsMutexDestroy(self->lock);
151154
}
152155

0 commit comments

Comments
 (0)