aboutsummaryrefslogtreecommitdiff
path: root/util/sconfig
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-08-03 15:51:19 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-08-04 06:59:51 +0200
commit1f68880e50a2b847838bbdc6916484f9fd86a681 (patch)
tree955c26ba1190793f6272314e9258bf5a0cb9e814 /util/sconfig
parent55391c422f8c45e40bb014d238769501aed65d56 (diff)
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@georgi-clan.de> Reviewed-on: http://review.coreboot.org/6484 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'util/sconfig')
-rw-r--r--util/sconfig/main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index f6ec0e200b..44d491161d 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);