From: Frank Mori Hess Date: Wed, 18 Jun 2003 00:06:20 +0000 (+0000) Subject: fix possible segfault X-Git-Tag: r0_7_21~77 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=04582261ab6f294f602c023270067ce46d8fc01f;p=comedilib.git fix possible segfault --- diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c index 117dc44..7cea71f 100644 --- a/comedi_calibrate/comedi_calibrate.c +++ b/comedi_calibrate/comedi_calibrate.c @@ -1591,13 +1591,16 @@ double fractional_offset( calibration_setup_t *setup, int subdevice, unsigned int channel, unsigned int range, int obs ) { comedi_range *range_ptr; - double target = setup->observables[obs].target; + double target; double reading; - unsigned int chanspec = setup->observables[obs].observe_insn.chanspec; + unsigned int chanspec; new_sv_t sv; if( subdevice < 0 || obs < 0 ) return 0.0; + chanspec = setup->observables[obs].observe_insn.chanspec; + target = setup->observables[obs].target; + range_ptr = comedi_get_range( setup->dev, subdevice, channel, range ); assert( range_ptr != NULL );