reduce_heads: fix memory leaks
[gitweb.git] / git-compat-util.h
index 9bc15b0363d562fc55268419055e9cdbbeee50c3..cedad4d5818a6e5c6e1732d34cf8fef6dab36718 100644 (file)
@@ -898,9 +898,11 @@ static inline char *xstrdup_or_null(const char *str)
 
 static inline size_t xsize_t(off_t len)
 {
-       if (len > (size_t) len)
+       size_t size = (size_t) len;
+
+       if (len != (off_t) size)
                die("Cannot handle files this big");
-       return (size_t)len;
+       return size;
 }
 
 __attribute__((format (printf, 3, 4)))