The SIGABRT(heap-use-after-free) was raised. It happened rarely when
the sdb is re-enabled after disabled due to unstable envrionment.
(But it is unclear what the unstable envrionment is.) To prevent this,
make a variable null after freeing it.
Change-Id: I2218004bf2069d6f8a6c835ba8883ece22f9c75b
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
usbg_cleanup(g_cfs_client->ctx);
err_usbg_init:
free(g_cfs_client);
+ g_cfs_client = NULL;
return ret;
}
usbg_rm_gadget(g_cfs_client->gadget, USBG_RM_RECURSE);
usbg_cleanup(g_cfs_client->ctx);
free(g_cfs_client);
+ g_cfs_client = NULL;
return 0;
}