From 78037a7ccb14725f5a2f72f6cec4e084a05fad0e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 28 Feb 2009 01:34:02 -0500 Subject: [PATCH] Valgrind fix: avoid overlapping memcpy() in sorting routines (thanks, JLM!). --- physfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/physfs.c b/physfs.c index 36edf8f..8b47a36 100644 --- a/physfs.c +++ b/physfs.c @@ -245,7 +245,8 @@ static void __PHYSFS_quick_sort(void *a, PHYSFS_uint32 lo, PHYSFS_uint32 hi, break; swapfn(a, i, j); } /* while */ - swapfn(a, i, hi-1); + if (i != (hi-1)) + swapfn(a, i, hi-1); __PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn); __PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn); } /* else */