free async->cmd.chanlist before it gets blown away by user's cmd
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 19 Oct 2005 03:10:32 +0000 (03:10 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 19 Oct 2005 03:10:32 +0000 (03:10 +0000)
comedi/comedi_fops.c

index 83cf1e8665bbbb7040c0251803e642dbff4d21e5..1c88bd143be4da6becd5592659586f6c84f3987b 100644 (file)
@@ -892,11 +892,10 @@ static int do_cmd_ioctl(comedi_device *dev,void *arg,void *file)
                goto cleanup;
        }
 
+       if(async->cmd.chanlist) kfree(async->cmd.chanlist);
        async->cmd=user_cmd;
        async->cmd.data=NULL;
-
        /* load channel/gain list */
-       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");