You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by dc...@apache.org on 2012/05/20 15:41:50 UTC

svn commit: r1340714 - in /avro/trunk: CHANGES.txt lang/c/src/datafile.c lang/c/src/schema_specific.c

Author: dcreager
Date: Sun May 20 13:41:50 2012
New Revision: 1340714

URL: http://svn.apache.org/viewvc?rev=1340714&view=rev
Log:
AVRO-1082. C: Avoid leaking open FILE objects

Contributed by Pugachev Maxim.

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/c/src/datafile.c
    avro/trunk/lang/c/src/schema_specific.c

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1340714&r1=1340713&r2=1340714&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Sun May 20 13:41:50 2012
@@ -85,6 +85,9 @@ Avro 1.7.0 (unreleased)
     AVRO-1094. Java: Fix specific compiler to better support
     non-default templates.  (Ed Kohlwey via cutting)
 
+    AVRO-1082. C: Avoid leaking open FILE objects.
+    (Pugachev Maxim via dcreager)
+
 Avro 1.6.3 (5 March 2012)
 
     AVRO-1077. Missing 'inline' for union set function. (thiru)

Modified: avro/trunk/lang/c/src/datafile.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/datafile.c?rev=1340714&r1=1340713&r2=1340714&view=diff
==============================================================================
--- avro/trunk/lang/c/src/datafile.c (original)
+++ avro/trunk/lang/c/src/datafile.c Sun May 20 13:41:50 2012
@@ -117,6 +117,7 @@ file_writer_init_fp(const char *path, co
 	}
 	w->writer = avro_writer_file(fp);
 	if (!w->writer) {
+		fclose(fp);
 		avro_set_error("Cannot create file writer for %s", path);
 		return ENOMEM;
 	}

Modified: avro/trunk/lang/c/src/schema_specific.c
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c/src/schema_specific.c?rev=1340714&r1=1340713&r2=1340714&view=diff
==============================================================================
--- avro/trunk/lang/c/src/schema_specific.c (original)
+++ avro/trunk/lang/c/src/schema_specific.c Sun May 20 13:41:50 2012
@@ -214,6 +214,7 @@ int avro_schema_to_specific(avro_schema_
 	snprintf(buf, sizeof(buf), "%s_avro.c", prefix);
 	ctx.source = fopen(buf, "w");
 	if (!ctx.source) {
+		fclose(ctx.header);
 		return errno;
 	}