Felix Singer has uploaded this change for review.
buspirate_spi.c: Call free() on a pointer only if it's not NULL
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I48e1621589cf84156a8849458ab2a8a8499bb427
---
M buspirate_spi.c
1 file changed, 18 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/90/67890/1
diff --git a/buspirate_spi.c b/buspirate_spi.c
index 0704887..cf84c9c 100644
--- a/buspirate_spi.c
+++ b/buspirate_spi.c
@@ -353,8 +353,9 @@
}
if (!spispeeds[i].name)
msg_perr("Invalid SPI speed, using default.\n");
+
+ free(tmp);
}
- free(tmp);
/* Extract serialspeed parameter */
tmp = extract_programmer_param_str(cfg, "serialspeed");
@@ -367,8 +368,9 @@
}
if (!serialspeeds[i].name)
msg_perr("Invalid serial speed %s, using default.\n", tmp);
+
+ free(tmp);
}
- free(tmp);
tmp = extract_programmer_param_str(cfg, "pullups");
if (tmp) {
@@ -378,8 +380,9 @@
; // ignore
else
msg_perr("Invalid pullups state, not using them.\n");
+
+ free(tmp);
}
- free(tmp);
tmp = extract_programmer_param_str(cfg, "psus");
if (tmp) {
@@ -389,8 +392,9 @@
; // ignore
else
msg_perr("Invalid psus state, not enabling.\n");
+
+ free(tmp);
}
- free(tmp);
/* Default buffer size is 19: 16 bytes data, 3 bytes control. */
#define DEFAULT_BUFSIZE (16 + 3)
To view, visit change 67890. To unsubscribe, or for help writing mail filters, visit settings.