aboutsummaryrefslogtreecommitdiffstats
path: root/core/taxonomy.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-09-05 13:30:04 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-09-06 12:59:54 -0700
commit55e42373066ade9ad2e1a51adf27a0a28cb0d02a (patch)
treee761e994b0584e647522108f15ecf705c45f1055 /core/taxonomy.c
parent6da78a29c4bcd42b93ef0044ec5e005f2ff93e0f (diff)
downloadsubsurface-55e42373066ade9ad2e1a51adf27a0a28cb0d02a.tar.gz
cleanup: copy string in taxonomy_set_[country|category]
These functions were taking a const char *, yet taking ownership of the value. Moreover, taking ownership of strings is rather unusual in C-style APIs. Let's copy the string instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/taxonomy.c')
-rw-r--r--core/taxonomy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/taxonomy.c b/core/taxonomy.c
index 45989e6c7..15086d28d 100644
--- a/core/taxonomy.c
+++ b/core/taxonomy.c
@@ -105,7 +105,7 @@ void taxonomy_set_category(struct taxonomy_data *t, enum taxonomy_category categ
}
idx = t->nr++;
}
- t->category[idx].value = value;
+ t->category[idx].value = strdup(value);
t->category[idx].origin = origin;
t->category[idx].category = category;
}