Fix memory leak noted by "Michael Brooks" <mbrooks@orbitalnetwork.com>
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 19 Oct 2005 02:38:01 +0000 (02:38 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 19 Oct 2005 02:38:01 +0000 (02:38 +0000)
comedi/comedi_fops.c

index 8db0b10d629c806c88da36a1710a923347b62ea9..83cf1e8665bbbb7040c0251803e642dbff4d21e5 100644 (file)
@@ -893,11 +893,10 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file)
        }
 
        async->cmd=user_cmd;
-       async->cmd.chanlist=NULL;
        async->cmd.data=NULL;
 
        /* load channel/gain list */
-       /* we should have this already allocated */
+       if(async->cmd.chanlist) kfree(async->cmd.chanlist);
        async->cmd.chanlist=kmalloc(async->cmd.chanlist_len*sizeof(int),GFP_KERNEL);
        if(!async->cmd.chanlist){
                DPRINTK("allocation failed\n");