]> sigrok.org Git - libsigrok.git/commitdiff
norma-dmm: fix a potential memory leak
authorGerhard Sittig <redacted>
Fri, 9 Feb 2018 18:22:14 +0000 (19:22 +0100)
committerUwe Hermann <redacted>
Fri, 9 Feb 2018 20:37:39 +0000 (21:37 +0100)
Release an allocated buffer in an error path.

This was reported by clang's scan-build.

src/hardware/norma-dmm/api.c

index 86cbd9c3d2203bd7733a7559e6a4ae2c1508d858..d155bc36d657b3b24f5f0817ae81caf5caa9e8b2 100644 (file)
@@ -110,6 +110,7 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
                if (serial_write_blocking(serial, req, strlen(req),
                                serial_timeout(serial, strlen(req))) < 0) {
                        sr_err("Unable to send identification request.");
                if (serial_write_blocking(serial, req, strlen(req),
                                serial_timeout(serial, strlen(req))) < 0) {
                        sr_err("Unable to send identification request.");
+                       g_free(buf);
                        return NULL;
                }
                len = BUF_MAX;
                        return NULL;
                }
                len = BUF_MAX;