WPrefs: fix NULL pointer dereference in the Pixmap/Icon path panel (Coverity #50073...
commit4b7bb5bc5c141e395551f6538a782c12ae3b6dac
authorChristophe CURIS <christophe.curis@free.fr>
Sat, 31 May 2014 17:58:40 +0000 (31 19:58 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 1 Jun 2014 19:35:06 +0000 (1 20:35 +0100)
tree9999a96913f6b7343d94cea64994ab6d0e19258f
parentc5744aaa8b047f0f3f58422a00ba3f03f0d2912b
WPrefs: fix NULL pointer dereference in the Pixmap/Icon path panel (Coverity #50073 + #50150)

As pointed by Coverity, it is possible to dereference the NULL pointer in
the function 'browseForFile'.
This should have been reported by the compiler ("possible use of
uninitialised variable") but the assignation of a default value to the
variable 'lPtr' hides this, but as the default value is not a good one then
the code could crash.
This patch removes the default value, so we may have some info from the
compiler and handles the case smoothly.

It also fixes a potential memory leak pointed also by Coverity in the
case where the string returned by WMGetFilePanelFileName would be a 0
length non-null string.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
WPrefs.app/Paths.c