aboutsummaryrefslogtreecommitdiffstats
path: root/test/c
diff options
context:
space:
mode:
Diffstat (limited to 'test/c')
-rw-r--r--test/c/Makefile2
-rw-r--r--test/c/knucleotide.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/test/c/Makefile b/test/c/Makefile
index a81a9d5c..59a0d834 100644
--- a/test/c/Makefile
+++ b/test/c/Makefile
@@ -38,7 +38,7 @@ test:
@for i in $(PROGS); do \
if ./$$i.compcert | cmp -s - Results/$$i; \
then echo "$$i: passed"; \
- else echo "$$i: FAILED"; \
+ else echo "$$i: FAILED"; exit 2; \
fi; \
done
diff --git a/test/c/knucleotide.c b/test/c/knucleotide.c
index f7438926..6bd0e9e7 100644
--- a/test/c/knucleotide.c
+++ b/test/c/knucleotide.c
@@ -62,10 +62,11 @@ struct ht_node *ht_node_create(char *key) {
perror("malloc ht_node");
exit(1);
}
- if ((newkey = (char *)strdup(key)) == 0) {
+ if ((newkey = malloc(strlen(key) + 1)) == 0) {
perror("strdup newkey");
exit(1);
}
+ strcpy(newkey, key);
node->key = newkey;
node->val = 0;
node->next = (struct ht_node *)NULL;