From 04582261ab6f294f602c023270067ce46d8fc01f Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 18 Jun 2003 00:06:20 +0000 Subject: [PATCH] fix possible segfault --- comedi_calibrate/comedi_calibrate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 ); -- 2.26.2