aboutsummaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/strbuf.c b/strbuf.c
index 38aca4f4..8d1c7f15 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -82,6 +82,12 @@ int strbuf_copy(strbuf* dest, strbuf* src) {
}
int strbuf_cmp(strbuf* a, strbuf* b) {
+#ifdef SAFE_STR
+ if (a->alloc == 0 || b->alloc == 0) {
+ ERR("a or b not alloced");
+ return -1;
+ }
+#endif
return strcmp(a->mem, b->mem);
}