dfu: add null check for thread 74/244574/1
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 22 Sep 2020 05:20:48 +0000 (14:20 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 22 Sep 2020 05:20:51 +0000 (14:20 +0900)
commitb81b7d964400a40c3839c5e9c9cadd7b97a00f8c
treee774bd93aa7d590380115ac58b002a5bfe4654a2
parent61d264453cf5c0abdd5ff013ea3a3c13f84142aa
dfu: add null check for thread

If dfu_start() is failed, there are cases ctx->thread is null and
this causes crash during dfu_free_context(). So add null check for
thread from dfu_free_context().

This fixes below crash-stack:
  Call Stack Count: 2
   0: pthread_cancel + 0x10 (0x0000007f81d9eab0) [/mnt/initrd-recovery/usr/lib64/libpthread.so.0] + 0x10ab0
   1: dfu_free_context + 0x1c (0x000000557ca2283c) [/mnt/initrd-recovery/usr/bin/flash-manager] + 0x483c
  End of Call Stack

Change-Id: I92fb9980047a3a58de516e81d694b7507662be26
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/dfu.c