1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-14 16:58:05 +00:00

tidy up free in device detect functions

This commit is contained in:
Kano 2013-06-10 15:39:44 +10:00
parent 9287ee90f6
commit 749fa78d8a
5 changed files with 20 additions and 13 deletions

View File

@ -653,11 +653,11 @@ unshin:
shin: shin:
if (avalon->device_data) free(avalon->device_data);
free(avalon->device_data); avalon->device_data = NULL;
if (avalon->device_path) free(avalon->device_path);
free(avalon->device_path); avalon->device_path = NULL;
avalon = usb_free_cgpu(avalon); avalon = usb_free_cgpu(avalon);

View File

@ -966,13 +966,15 @@ unshin:
shin: shin:
free(bflsc->device_path); free(bflsc->device_path);
bflsc->device_path = NULL;
free(bflsc->device_data); free(bflsc->device_data);
bflsc->device_data = NULL;
if (bflsc->name != blank) if (bflsc->name != blank) {
free(bflsc->name); free(bflsc->name);
bflsc->name = NULL;
if (bflsc->drv->copy) }
free(bflsc->drv);
bflsc = usb_free_cgpu(bflsc); bflsc = usb_free_cgpu(bflsc);

View File

@ -287,12 +287,12 @@ unshin:
shin: shin:
free(bitforce->device_path); free(bitforce->device_path);
bitforce->device_path = NULL;
if (bitforce->name != blank) if (bitforce->name != blank) {
free(bitforce->name); free(bitforce->name);
bitforce->name = NULL;
if (bitforce->drv->copy) }
free(bitforce->drv);
bitforce = usb_free_cgpu(bitforce); bitforce = usb_free_cgpu(bitforce);

View File

@ -843,6 +843,7 @@ unshin:
usb_uninit(icarus); usb_uninit(icarus);
free(icarus->device_path); free(icarus->device_path);
icarus->device_path = NULL;
shin: shin:

View File

@ -210,6 +210,7 @@ static bool modminer_detect_one(struct libusb_device *dev, struct usb_find_devic
if (!add_cgpu(tmp)) { if (!add_cgpu(tmp)) {
free(tmp->device_path); free(tmp->device_path);
tmp->device_path = NULL;
tmp = usb_free_cgpu(tmp); tmp = usb_free_cgpu(tmp);
goto unshin; goto unshin;
} }
@ -228,8 +229,10 @@ unshin:
usb_uninit(modminer); usb_uninit(modminer);
shin: shin:
if (!added) if (!added) {
free(modminer->modminer_mutex); free(modminer->modminer_mutex);
modminer->modminer_mutex = NULL;
}
modminer = usb_free_cgpu(modminer); modminer = usb_free_cgpu(modminer);
@ -1096,6 +1099,7 @@ static void modminer_hw_error(struct thr_info *thr)
static void modminer_fpga_shutdown(struct thr_info *thr) static void modminer_fpga_shutdown(struct thr_info *thr)
{ {
free(thr->cgpu_data); free(thr->cgpu_data);
thr->cgpu_data = NULL;
} }
static char *modminer_set_device(struct cgpu_info *modminer, char *option, char *setting, char *replybuf) static char *modminer_set_device(struct cgpu_info *modminer, char *option, char *setting, char *replybuf)