Add line number to debug log for memory allocation errors.
This commit is contained in:
@@ -80,7 +80,7 @@ sudo_ev_base_alloc_v1(void)
|
||||
|
||||
base = calloc(1, sizeof(*base));
|
||||
if (base == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR,
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to allocate base", __func__);
|
||||
debug_return_ptr(NULL);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ sudo_ev_alloc_v1(int fd, short events, sudo_ev_callback_t callback, void *closur
|
||||
|
||||
ev = calloc(1, sizeof(*ev));
|
||||
if (ev == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR,
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to allocate event", __func__);
|
||||
debug_return_ptr(NULL);
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ sudo_ev_base_alloc_impl(struct sudo_event_base *base)
|
||||
base->pfd_max = 32;
|
||||
base->pfds = reallocarray(NULL, base->pfd_max, sizeof(struct pollfd));
|
||||
if (base->pfds == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR,
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to allocate %d pollfds", __func__, base->pfd_max);
|
||||
base->pfd_max = 0;
|
||||
debug_return_int(-1);
|
||||
@@ -84,7 +84,7 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
|
||||
pfds =
|
||||
reallocarray(base->pfds, base->pfd_max, 2 * sizeof(struct pollfd));
|
||||
if (pfds == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR,
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to allocate %d pollfds", __func__, base->pfd_max * 2);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
|
@@ -59,8 +59,8 @@ sudo_ev_base_alloc_impl(struct sudo_event_base *base)
|
||||
|
||||
if (base->readfds_in == NULL || base->writefds_in == NULL ||
|
||||
base->readfds_out == NULL || base->writefds_out == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_WARN, "%s: unable to calloc(1, %zu)",
|
||||
__func__, sizeof(fd_mask));
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to calloc(1, %zu)", __func__, sizeof(fd_mask));
|
||||
sudo_ev_base_free_impl(base);
|
||||
debug_return_int(-1);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ sudo_ev_add_impl(struct sudo_event_base *base, struct sudo_event *ev)
|
||||
wfds_out = reallocarray(base->writefds_out, n, sizeof(fd_mask));
|
||||
if (rfds_in == NULL || wfds_in == NULL ||
|
||||
rfds_out == NULL || wfds_out == NULL) {
|
||||
sudo_debug_printf(SUDO_DEBUG_WARN,
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
|
||||
"%s: unable to reallocarray(%d, %zu)",
|
||||
__func__, n, sizeof(fd_mask));
|
||||
free(rfds_in);
|
||||
|
Reference in New Issue
Block a user