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:
Gerhard Sittig 2018-02-09 19:30:45 +01:00 committed by Uwe Hermann
parent aedbf89d85
commit 2da5c95f3d
1 changed files with 3 additions and 1 deletions

View File

@ -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;