[coreboot-gerrit] New patch to review for coreboot: 927a150 sconfig: more careful string resource handling
Patrick Georgi (patrick@georgi-clan.de)
gerrit at coreboot.org
Sun Aug 3 15:52:38 CEST 2014
Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6484
-gerrit
commit 927a150faf917b5b9da5406d9b9356702a5a001f
Author: Patrick Georgi <patrick at georgi-clan.de>
Date: Sun Aug 3 15:51:19 2014 +0200
sconfig: more careful string resource handling
When parsing a string to numbers, we don't need to copy it.
And when creating strings, we should eventually free them.
Change-Id: I9023fef6e97a1830bc68502be32e79879c1617d4
Found-By: Coverity Scan
Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
util/sconfig/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 20471de..ce39a11 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -195,6 +195,7 @@ struct device *new_chip(struct device *parent, struct device *bus, char *path) {
parent->latestchild = new_chip;
if (!parent->children)
parent->children = new_chip;
+ free(chip_h);
return new_chip;
}
@@ -225,7 +226,7 @@ struct device *new_device(struct device *parent, struct device *busdev, const in
new_d->bustype = bus;
char *tmp;
- new_d->path_a = strtol(strdup(devnum), &tmp, 16);
+ new_d->path_a = strtol(devnum, &tmp, 16);
if (*tmp == '.') {
tmp++;
new_d->path_b = strtol(tmp, NULL, 16);
More information about the coreboot-gerrit
mailing list