Skip to content

Commit

Permalink
pcmcia: avoid static analysis complaint about use-after-free
Browse files Browse the repository at this point in the history
Coverity complains about a use after free for 'res1' and 'res2' since
we use the value of the pointers in a 'dev_dbg()' after they have been
freed. That's not really a problem, but it still seems cleaner to
defer freeing until we are completely done with the pointers.

Signed-off-by: Jesper Juhl <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
  • Loading branch information
jjuhl authored and Jiri Kosina committed Jan 20, 2013
1 parent 4de8027 commit bec0b2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/pcmcia/rsrc_nonstatic.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ static int do_validate_mem(struct pcmcia_socket *s,
}
}

free_region(res2);
free_region(res1);

dev_dbg(&s->dev, "cs: memory probe 0x%06lx-0x%06lx: %p %p %u %u %u",
base, base+size-1, res1, res2, ret, info1, info2);

free_region(res2);
free_region(res1);

if ((ret) || (info1 != info2) || (info1 == 0))
return -EINVAL;

Expand Down

0 comments on commit bec0b2c

Please sign in to comment.