1
diff -ur maradns-1.2.12/parse/Csv2_database.c maradns-tidy/parse/Csv2_database.c
2
--- maradns-1.2.12/parse/Csv2_database.c 2006-07-25 02:35:26.000000000 -0500
3
+++ maradns-tidy/parse/Csv2_database.c 2006-07-25 02:32:05.000000000 -0500
8
+void csv2_zap_add_state(csv2_add_state *x) {
13
+ /* Get rid of the origin stack */
15
+ while(v != 0 && a < 10000) {
16
+ js_destroy(v->origin);
24
+ /* Get rid of the buffer of rrs */
26
+ while(y != 0 && a < 10000) {
27
+ js_destroy(y->query);
28
+ js_destroy(y->data);
36
+ /* Get rid of the zone string */
38
+ js_destroy(x->zone);
42
+ /* And now, finally, get rid of this object, I mean structure */
46
+/* Function to clean up the memory used by a given csv2_add_state; if this
47
+ * were object-oriented, this function would be the deconstructor for the
50
/* Function to set the big hash we point to
51
* Input: Pointer to hash
52
* Output: JS_ERROR on error; JS_SUCCESS on success */
54
/* Function that closes out the state for processing parsed records;
55
* JS_ERROR on error, JS_SUCCESS on success */
56
int csv2_close_state(csv2_add_state *state) {
57
- return js_dealloc(state);
58
+ csv2_zap_add_state(state);
62
/* Function that uses stat() to determine the timestamp to put in the
67
+ js_dealloc(state->buffer->query); /* This is copied in
69
+ js_dealloc(state->buffer->data); /* We finally copy this in
70
+ * mhash_put_rr/mhash_add_rr */
71
js_dealloc(state->buffer);
74
diff -ur maradns-1.2.12/parse/Csv2_functions.h maradns-tidy/parse/Csv2_functions.h
75
--- maradns-1.2.12/parse/Csv2_functions.h 2006-07-25 02:35:26.000000000 -0500
76
+++ maradns-tidy/parse/Csv2_functions.h 2006-07-25 02:08:54.000000000 -0500
79
csv2_add_state *csv2_init_add_state(js_string *zone);
81
+/* This function releases the memory resources that the csv2_add_state
83
+void csv2_zap_add_state(csv2_add_state *x);
85
/* Function to set the big hash we point to
86
* Input: Pointer to hash
87
* Output: JS_ERROR on error; JS_SUCCESS on success */
88
diff -ur maradns-1.2.12/parse/Csv2_main.c maradns-tidy/parse/Csv2_main.c
89
--- maradns-1.2.12/parse/Csv2_main.c 2006-07-25 02:35:26.000000000 -0500
90
+++ maradns-tidy/parse/Csv2_main.c 2006-07-25 02:35:08.000000000 -0500
92
printf("Error opening ");
93
show_esc_stdout(filename);
95
+ csv2_zap_add_state(state);
100
unsigned char get[3];
101
if(csv2_tcp_spit_soa(state, connect, header, zone)
103
+ csv2_zap_add_state(state);
106
/* Determine how long the next query will be */
107
if(connect == 1) { /* STDIN for inetd hack */
108
- if(read(0,get,2) != 1)
109
+ if(read(0,get,2) != 1) {
110
+ csv2_zap_add_state(state);
114
- if(recv(connect,get,2,0) != 2)
115
+ if(recv(connect,get,2,0) != 2) {
116
+ csv2_zap_add_state(state);
120
length = (get[0] & 0xff) << 8 | (get[1] & 0xff);
121
/* Pretend to get the next, actual, query */
123
if(connect == 1) { /* STDIN; for inetd hack */
124
- if(read(0,get,1) != 1)
125
+ if(read(0,get,1) != 1) {
126
+ csv2_zap_add_state(state);
130
- if(recv(connect,get,1,MSG_WAITALL) != 1)
131
+ if(recv(connect,get,1,MSG_WAITALL) != 1) {
132
+ csv2_zap_add_state(state);
139
/* Second, flush the buffer out */
140
if(csv2_tcp_spit_buffer(state,connect,header,zone) == JS_ERROR) {
141
js_dealloc(soa_save);
142
+ csv2_zap_add_state(state);
147
if(csv2_tcp_spit_buffer(state,connect,header,zone) ==
149
js_dealloc(soa_save);
150
+ csv2_zap_add_state(state);
155
if(csv2_tcp_spit_data(state,connect,header,zone,3,soa_save)
157
js_dealloc(soa_save);
158
+ csv2_zap_add_state(state);
161
+ csv2_zap_add_state(state);
166
printf("Error opening ");
167
show_esc_stdout(filename);
169
+ csv2_zap_add_state(state);
177
+ csv2_zap_add_state(state);