Skip to content

Releases: phil-base/tripwire

v0.2.0 — Standard compliance and test infrastructure

01 Apr 10:11

Choose a tag to compare

What's new

Standard C compatibility

  • free(NULL) is now a no-op per the C standard
  • realloc(NULL, size) delegates to malloc(size)
  • realloc(p, 0) delegates to free(p) and returns NULL

Tracker lifecycle

  • New tripwire_cleanup() function frees all internal tracking state
  • Freed nodes retain history for double-free detection
  • Dangling alloc pointers nulled after free

Arithmetic hardening

  • Overflow guards on malloc, calloc, and realloc size calculations
  • calloc detects nmemb * size overflow before allocating

Code quality

  • const correctness on all file parameters
  • Fixed typos in realloc/free error messages
  • Sentinel checks added to free() path

Project infrastructure

  • Portable test suite (test.c, 18 tests) — no POSIX dependency
  • Fatal-path test suite (test_fatal.c, 4 tests) — POSIX only
  • make run for portable tests, make run-all for full suite
  • CI matrix: GCC + Clang on Ubuntu and macOS
  • Limitations section in README
  • MIT license (switched from BSD 2-Clause)

v0.1.0 — Initial release

06 Mar 08:19

Choose a tag to compare

Lightweight C memory debugging wrapper. Drop in two files, catch buffer overflows, double frees, and leaks.

Features

  • Transparent replacement of malloc, realloc, calloc, strdup, free, memset, memcpy, and memmove via preprocessor macros
  • Sentinel-based buffer overflow and underflow detection
  • Double-free and invalid-pointer detection
  • Leak reporting via tripwire_report()
  • File and line number in all diagnostics

Usage

Copy tripwire.h and tripwire.c into your project, include the header after your standard headers, and compile with tripwire.c. See the README for details.