tondaj-sl-814: fix a potential memory leak
Release an allocated device instance in an error path. This was reported by clang's scan-build.
This commit is contained in:
parent
aedbf89d85
commit
2da5c95f3d
|
@ -82,8 +82,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
serial = sr_serial_dev_inst_new(conn, serialcomm);
|
||||
|
||||
if (serial_open(serial, SERIAL_RDWR) != SR_OK)
|
||||
if (serial_open(serial, SERIAL_RDWR) != SR_OK) {
|
||||
g_free(sdi);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sdi->inst_type = SR_INST_SERIAL;
|
||||
sdi->conn = serial;
|
||||
|
|
Loading…
Reference in New Issue