From 681930474072737451ca95ab5682c7ad69e95060 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Mar 2002 18:54:51 +0000 Subject: [PATCH] a quick fix for a segmentation fault in zlib I am getting whenever I try to upload a file from rsync 2.5.2 to rsync 2.5.3 --- zlib/zutil.c | 2 +- zlib/zutil.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zlib/zutil.c b/zlib/zutil.c index 7fb0327b..2aafdab3 100644 --- a/zlib/zutil.c +++ b/zlib/zutil.c @@ -213,7 +213,7 @@ void zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { - free(ptr); + if (ptr) free(ptr); if (opaque) return; /* make compiler happy */ } diff --git a/zlib/zutil.h b/zlib/zutil.h index f1d583e4..fbf2a980 100644 --- a/zlib/zutil.h +++ b/zlib/zutil.h @@ -217,7 +217,7 @@ void zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define ZFREE(strm, addr) ((*((strm)->zfree))((strm)->opaque, (voidpf)(addr)),(addr)=NULL) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #endif /* _Z_UTIL_H */ -- 2.34.1