summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-02 13:06:31 +0200
committerTyge Løvset <[email protected]>2022-05-02 13:06:31 +0200
commit00b63b1930300ddb1e40f3f16315c8d58c31543b (patch)
tree6248c81c7af89aedec38ba9c2a8b97e9f67fc978
parent14d7862488113da31ca2b918dc9f0904b2e65785 (diff)
downloadSTC-modified-00b63b1930300ddb1e40f3f16315c8d58c31543b.tar.gz
STC-modified-00b63b1930300ddb1e40f3f16315c8d58c31543b.zip
Fixed undefined behaviour (but working) code in carc.
-rw-r--r--include/stc/carc.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/stc/carc.h b/include/stc/carc.h
index 031c4f56..245ba708 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -130,7 +130,7 @@ STC_INLINE void
_cx_memb(_drop)(_cx_self* self) {
if (self->use_count && _i_atomic_dec_and_test(self->use_count)) {
i_keydrop(self->get);
- if (self->get != &((_cx_carc_rep *)self->use_count)->value)
+ if ((char *)self->get != (char *)self->use_count + offsetof(_cx_carc_rep, value))
c_free(self->get);
c_free(self->use_count);
}