avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcrea...@apache.org
Subject svn commit: r1386903 - in /avro/trunk: CHANGES.txt lang/c/tests/test_avro_schema.c
Date Mon, 17 Sep 2012 23:13:15 GMT
Author: dcreager
Date: Mon Sep 17 23:13:15 2012
New Revision: 1386903

URL: http://svn.apache.org/viewvc?rev=1386903&view=rev
Log:
AVRO-1164. C: Fix valgrind warnings in avro_test_schema

Contributed by Vivek Nadkarni.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/c/tests/test_avro_schema.c

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1386903&r1=1386902&r2=1386903&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Mon Sep 17 23:13:15 2012
@@ -83,6 +83,9 @@ Avro 1.7.2 (unreleased)
     AVRO-1150. Java: Fix tests to create all temporary files in target
     directories.  (Gabriel Reid via cutting)
 
+    AVRO-1164. C: Clean up valgrind warnings in test_avro_schema test case.
+    (Vivek Nadkarni via dcreager)
+
 Avro 1.7.1 (16 July 2012)
 
   NEW FEATURES

Modified: avro/trunk/lang/c/tests/test_avro_schema.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/tests/test_avro_schema.c?rev=1386903&r1=1386902&r2=1386903&view=diff
==============================================================================
--- avro/trunk/lang/c/tests/test_avro_schema.c (original)
+++ avro/trunk/lang/c/tests/test_avro_schema.c Mon Sep 17 23:13:15 2012
@@ -33,7 +33,7 @@ avro_writer_t avro_stderr;
 static void run_tests(char *dirpath, int should_pass)
 {
 	char jsontext[4096];
-	size_t jsonlen, rval;
+	size_t rval;
 	char filepath[1024];
 	DIR *dir;
 	struct dirent *dent;
@@ -57,13 +57,13 @@ static void run_tests(char *dirpath, int
 			snprintf(filepath, sizeof(filepath), "%s/%s", dirpath,
 				 dent->d_name);
 			fprintf(stderr, "TEST %s...", filepath);
-			jsonlen = 0;
 			fp = fopen(filepath, "r");
 			if (!fp) {
 				fprintf(stderr, "can't open!\n");
 				exit(EXIT_FAILURE);
 			}
 			rval = fread(jsontext, 1, sizeof(jsontext) - 1, fp);
+			fclose(fp);
 			jsontext[rval] = '\0';
 			test_rval =
 			    avro_schema_from_json(jsontext, 0, &schema, NULL);
@@ -104,6 +104,7 @@ static void run_tests(char *dirpath, int
 		}
 	}
 	while (dent != NULL);
+	closedir(dir);
 }
 
 static int test_array(void)
@@ -164,6 +165,8 @@ static int test_fixed(void)
 		fprintf(stderr, "Unexpected fixed size\n");
 		exit(EXIT_FAILURE);
 	}
+
+	avro_schema_decref(schema);
 	return 0;
 }
 



Mime
View raw message