Fix redundant null check on calling free()

This commit is contained in:
Szymon Janc 2011-05-09 13:52:13 +02:00 committed by Johan Hedberg
parent 18de55c8ad
commit 11e433f53e
3 changed files with 9 additions and 16 deletions

View File

@ -341,8 +341,7 @@ create:
err = ioctl(ctl, HIDPCONNADD, &req);
error:
if (req.rd_data)
free(req.rd_data);
free(req.rd_data);
return err;
}

View File

@ -1226,8 +1226,7 @@ int main(int argc, char *argv[])
if (transport_open(transport, device, bcsp_rate) < 0)
exit(1);
if (device)
free(device);
free(device);
for (i = 0; commands[i].str; i++) {
if (strcasecmp(commands[i].str, argv[0]))

View File

@ -148,8 +148,8 @@ static int write_cmd(int fd, uint8_t *buffer, int len)
return err;
err = read_ps_event(event, HCI_PS_CMD_OCF);
if (event)
free(event);
free(event);
return err;
}
@ -493,8 +493,7 @@ static int set_patch_ram(int dev, char *patch_loc, int len)
err = read_ps_event(event, HCI_PS_CMD_OCF);
if (event)
free(event);
free(event);
return err;
}
@ -623,8 +622,7 @@ static int get_ath3k_crc(int dev)
if (read_ps_event(event, HCI_PS_CMD_OCF) >= 0)
err = -EILSEQ;
if (!event)
free(event);
free(event);
return err;
}
@ -667,8 +665,7 @@ static int get_device_type(int dev, uint32_t *code)
*code = reg;
cleanup:
if (event)
free(event);
free(event);
return err;
}
@ -709,8 +706,7 @@ static int read_ath3k_version(int pConfig, uint32_t *rom_version,
*build_version = status;
cleanup:
if (event)
free(event);
free(event);
return err;
}
@ -768,8 +764,7 @@ static int write_bdaddr(int pConfig, char *bdaddr)
err = read_ps_event(event, HCI_PS_CMD_OCF);
if (event)
free(event);
free(event);
return err;
}