Changeset 87a2f9b in mainline


Ignore:
Timestamp:
2015-06-04T14:29:11Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4d11204, b5143bd
Parents:
7ec3c56
Message:

fix memory leak in error paths
(detected by Coverity as CID 10087, 10300, 10305)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/udebug/udebug_ops.c

    r7ec3c56 r87a2f9b  
    375375        if (TASK->udebug.dt_state != UDEBUG_TS_ACTIVE) {
    376376                mutex_unlock(&TASK->udebug.lock);
     377                free(id_buffer);
    377378                return EINVAL;
    378379        }
     
    456457int udebug_args_read(thread_t *thread, void **buffer)
    457458{
    458         /* Prepare a buffer to hold the arguments. */
    459         sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
    460        
    461459        /* On success, this will lock t->udebug.lock. */
    462460        int rc = _thread_op_begin(thread, false);
     
    471469        }
    472470       
     471        /* Prepare a buffer to hold the arguments. */
     472        sysarg_t *arg_buffer = malloc(6 * sizeof(sysarg_t), 0);
     473       
    473474        /* Copy to a local buffer before releasing the lock. */
    474475        memcpy(arg_buffer, thread->udebug.syscall_args, 6 * sizeof(sysarg_t));
     
    499500int udebug_regs_read(thread_t *thread, void **buffer)
    500501{
    501         /* Prepare a buffer to hold the data. */
    502         istate_t *state_buf = malloc(sizeof(istate_t), 0);
    503        
    504502        /* On success, this will lock t->udebug.lock */
    505503        int rc = _thread_op_begin(thread, false);
     
    512510                return EBUSY;
    513511        }
     512       
     513        /* Prepare a buffer to hold the data. */
     514        istate_t *state_buf = malloc(sizeof(istate_t), 0);
    514515       
    515516        /* Copy to the allocated buffer */
Note: See TracChangeset for help on using the changeset viewer.