remoting: Fix file-chooser crash on Linux official build.

The clean-up code for the Linux file-chooser was using the
g_clear_pointer convenience macro, which uses a few type casts under the
hood in an effort to ensure single evaluation of each operand while
avoiding any type-related compiler warnings. Unfortunately, this trips
the indirect-function-call control-flow-integrity sanitizer
(-fsanitize=cfi-icall), which appears only to be enabled for official
builds.

This change avoids the problem by manually checking the pointer, freeing
it if necessary, and setting it to null, rather than using the
convenience macro.

Bug: 940662
Change-Id: I03dc8d4c6dfb221ab45dce38ff018e41c54d7e40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1516775
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Erik Jensen <rkjnsn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#639700}
1 file changed