Free elements of rangeinfo_list on close.
authorIan Abbott <abbotti@mev.co.uk>
Thu, 17 Jan 2008 13:50:32 +0000 (13:50 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Thu, 17 Jan 2008 13:50:32 +0000 (13:50 +0000)
lib/comedi.c

index 34ed3e9312c24b99eef9aeda9912257d8cdb26e8..91903ae2575f4c3274fefbb37579c289f301f606 100644 (file)
@@ -87,7 +87,7 @@ EXPORT_ALIAS_DEFAULT(_comedi_close,comedi_close,0.7.18);
 int _comedi_close(comedi_t *it)
 {
        subdevice *s;
-       int i;
+       int i,j;
 
        it->magic=0;
 
@@ -104,6 +104,8 @@ int _comedi_close(comedi_t *it)
                }
                if(s->subd_flags&SDF_RANGETYPE){
                        free(s->range_type_list);
+                       for(j=0;j<s->n_chan;j++)
+                               free(s->rangeinfo_list[j]);
                        free(s->rangeinfo_list);
                }else{
                        free(s->rangeinfo);