Skip to content

Commit

Permalink
iio: adc: ad7280a: Fix memory leak
Browse files Browse the repository at this point in the history
Free channels in case read fails with error.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent e15fbc9 commit 703a9ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/iio/adc/ad7280a.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)

ret = ad7280_read_all_channels(st, st->scan_cnt, channels);
if (ret < 0)
return IRQ_HANDLED;
goto out;

for (i = 0; i < st->scan_cnt; i++) {
if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) {
Expand Down Expand Up @@ -731,6 +731,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
}
}

out:
kfree(channels);

return IRQ_HANDLED;
Expand Down

0 comments on commit 703a9ce

Please sign in to comment.