From 5210a06d15f0525f7c0d487e737f1e33a8b40f8e Mon Sep 17 00:00:00 2001 From: Dave Hansen Date: Mon, 8 Aug 2011 12:48:40 -0700 Subject: [PATCH] valgrind fixes valgrind really does not like -static. It throws thousands of false positives. So, make the build non-static, then fix up a couple of valgrind-detected leaks. --- Makefile | 2 +- eyefi-unix.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 18e0c14..0dce24f 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ifeq ($(PLATFORM),FreeBSD) endif eyefi-config: $(OBJS) - $(CC) $(CFLAGS) $(OBJS) -static -o $@ + $(CC) $(CFLAGS) $(OBJS) -o $@ clean: rm eyefi-config core $(OBJS) cscope* diff --git a/eyefi-unix.c b/eyefi-unix.c index e674089..b31d9ed 100755 --- a/eyefi-unix.c +++ b/eyefi-unix.c @@ -267,6 +267,7 @@ int print_log(void) total_bytes = get_log_into(resbuf); if (total_bytes < 0) { debug_printf(1, "%s() error: %d\n", __func__, total_bytes); + free(resbuf); return total_bytes; } // The last byte *should* be a null, and the @@ -297,6 +298,7 @@ int print_log(void) } } */ + free(resbuf); return 0; }