]> granicus.if.org Git - sudo/commitdiff
Add line number to debug log for memory allocation errors.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Jul 2015 20:47:12 +0000 (14:47 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Jul 2015 20:47:12 +0000 (14:47 -0600)
lib/util/event.c
lib/util/event_poll.c
lib/util/event_select.c

index 703f8f243157f7449133346c676dba2bcbbd9a35..f618bb7dff93f90d2666d0ac46ab022e470158df 100644 (file)
@@ -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);
     }
index e238c381395139d3fec9cf78f0a0d53874fce340..5266a2b2f2462dd2e62017b89d9e6b81f848e841 100644 (file)
@@ -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);
        }
index 75e83077549bda5eab34778ffec032b8e9e59fb3..b6380faecab9eea62a27197851641b24f6120df9 100644 (file)
@@ -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);