mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
dereferencing: Small fixes for deref errors.
Cleanup some dereferencing after free. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
parent
a57f1c9691
commit
177f77f1f2
@ -30,6 +30,7 @@ gp2y0a_context gp2y0a_init(uint8_t pin, float a_ref){
|
||||
dev->pin = pin;
|
||||
dev->aio = mraa_aio_init(dev->pin);
|
||||
if(dev->aio == NULL){
|
||||
free(dev);
|
||||
return NULL;
|
||||
}
|
||||
dev->a_res = (1 << mraa_aio_get_bit(dev->aio));
|
||||
|
@ -41,8 +41,8 @@ mpr121_context mpr121_init(int bus, uint8_t address){
|
||||
}
|
||||
|
||||
if (mraa_i2c_address(dev->i2c, dev->address) != MRAA_SUCCESS){
|
||||
free(dev);
|
||||
printf("error using i2c address: %x\n", dev->address);
|
||||
free(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user