core: Add pointer box / RAII impl
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
@@ -33,6 +33,11 @@ state_init(struct cescal_state *state, const char *pathname)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ptrbox_init(&state->ptrbox) < 0) {
|
||||
close(state->in_fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -41,4 +46,5 @@ state_close(struct cescal_state *state)
|
||||
{
|
||||
close(state->in_fd);
|
||||
state->in_fd = -1;
|
||||
ptrbox_destroy(&state->ptrbox);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user