mtd: mtd_blkdevs: fix double free on error path
authorMaxim Levitsky <maximlevitsky@gmail.com>
Sat, 8 Jan 2011 23:25:06 +0000 (01:25 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 19:49:52 +0000 (12:49 -0700)
commit30b42e4aff84734185f703c6e703421d196801c3
tree03d0d7a875452ab6ab595bd045a32e839228e8dc
parent5f4cd26f5139f5a10ccb414d804f132d4f0a1781
mtd: mtd_blkdevs: fix double free on error path

commit bd637f6f22235b4613f9ab6555e8088a455c1ed4 upstream.

This one liner patch fixes double free that will occur if add_mtd_blktrans_dev
fails. On failure it frees the input argument, but all its users also free it
on error which is natural thing to do. Thus don't free it.

All credit for finding that bug belongs to reporters of the bug in the android bugzilla
http://code.google.com/p/android/issues/detail?id=13761

Commit message tweaked by Artem.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/mtd/mtd_blkdevs.c