lkml.org 
[lkml]   [2003]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] bttv-risc.c (was: Re: [CHECKER] 32 Memory Leaks on Error Paths)
    David Yu Chen wrote:
    > Hi All,
    [snip]
    > ---------------------------------------------------------
    >
    > [FILE: 2.6.0-test5/drivers/media/video/bttv-risc.c]
    > [FUNC: bttv_risc_overlay]
    > [LINES: 214-223]
    > [VAR: skips]
    > 209: struct btcx_skiplist *skips;
    > 210: u32 *rp,ri,ra;
    > 211: u32 addr;
    > 212:
    > 213: /* skip list for window clipping */
    > START -->
    > 214: if (NULL == (skips = kmalloc(sizeof(*skips) * ov->nclips,GFP_KERNEL)))
    > 215: return -ENOMEM;
    > 216:
    > 217: /* estimate risc mem: worst case is (clip+1) * lines instructions
    > 218: + sync + jump (all 2 dwords) */
    > 219: instructions = (ov->nclips + 1) *
    > 220: ((skip_even || skip_odd) ? ov->w.height>>1 : ov->w.height);
    > 221: instructions += 2;
    > 222: if ((rc = btcx_riscmem_alloc(btv->dev,risc,instructions*8)) < 0)
    > END -->
    > 223: return rc;
    > 224:
    > 225: /* sync instruction */
    > 226: rp = risc->cpu;
    > 227: *(rp++) = cpu_to_le32(BT848_RISC_SYNC|BT848_FIFO_STATUS_FM1);
    > 228: *(rp++) = cpu_to_le32(0);
    > ---------------------------------------------------------
    >

    Correct?


    --- linux-2.6.0-test5.old/drivers/media/video/bttv-risc.c 2003-08-23 07:55:44.000000000 +0800
    +++ linux-2.6.0-test5.new/drivers/media/video/bttv-risc.c 2003-09-16 16:48:37.000000000 +0800
    @@ -219,8 +219,10 @@
    instructions = (ov->nclips + 1) *
    ((skip_even || skip_odd) ? ov->w.height>>1 : ov->w.height);
    instructions += 2;
    - if ((rc = btcx_riscmem_alloc(btv->dev,risc,instructions*8)) < 0)
    + if ((rc = btcx_riscmem_alloc(btv->dev,risc,instructions*8)) < 0) {
    + kfree(skips);
    return rc;
    + }

    /* sync instruction */
    rp = risc->cpu;
    \
     
     \ /
      Last update: 2005-03-22 13:48    [W:2.603 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site