Merge lp:~brianaker/drizzle/libdrizzle-valgrind-test-warnings into lp:~drizzle-trunk/drizzle/development
- libdrizzle-valgrind-test-warnings
- Merge into development
Proposed by
Brian Aker
Status: | Merged |
---|---|
Approved by: | Brian Aker |
Approved revision: | 2473 |
Merged at revision: | 2474 |
Proposed branch: | lp:~brianaker/drizzle/libdrizzle-valgrind-test-warnings |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
620 lines (+131/-43) 15 files modified
libdrizzle-1.0/t/client_server.c (+10/-1) libdrizzle-1.0/t/drizzle_column_st.c (+12/-0) libdrizzle/column.cc (+31/-8) libdrizzle/command.cc (+2/-1) libdrizzle/conn.cc (+2/-1) libdrizzle/conn_uds.cc (+2/-1) libdrizzle/drizzle.cc (+8/-3) libdrizzle/field.cc (+20/-5) libdrizzle/handshake.cc (+2/-1) libdrizzle/mysql_password_hash.cc (+2/-1) libdrizzle/pack.cc (+2/-1) libdrizzle/query.cc (+7/-2) libdrizzle/result.cc (+19/-11) libdrizzle/row.cc (+10/-6) libdrizzle/state.cc (+2/-1) |
To merge this branch: | bzr merge lp:~brianaker/drizzle/libdrizzle-valgrind-test-warnings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Merge Team | Pending | ||
Review via email: mp+86000@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'libdrizzle-1.0/t/client_server.c' |
2 | --- libdrizzle-1.0/t/client_server.c 2011-12-14 20:53:40 +0000 |
3 | +++ libdrizzle-1.0/t/client_server.c 2011-12-16 07:15:29 +0000 |
4 | @@ -1,4 +1,5 @@ |
5 | -/* |
6 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
7 | + * |
8 | * Drizzle Client & Protocol Library |
9 | * |
10 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
11 | @@ -105,7 +106,9 @@ |
12 | |
13 | drizzle_test("drizzle_create"); |
14 | if (drizzle_create(&drizzle) == NULL) |
15 | + { |
16 | drizzle_test_error("returned NULL"); |
17 | + } |
18 | |
19 | drizzle_test("drizzle_con_add_tcp_listen"); |
20 | if (drizzle_con_add_tcp_listen(&drizzle, &listen_con, DRIZZLE_TEST_HOST, |
21 | @@ -160,7 +163,9 @@ |
22 | drizzle_test("drizzle_con_wait"); |
23 | ret= drizzle_con_wait(&drizzle); |
24 | if (ret != DRIZZLE_RETURN_OK) |
25 | + { |
26 | drizzle_test_error("returned %s (%d)", drizzle_error(&drizzle), ret); |
27 | + } |
28 | } |
29 | |
30 | if (server_accepted) |
31 | @@ -212,7 +217,9 @@ |
32 | return; |
33 | } |
34 | else if (ret != DRIZZLE_RETURN_OK) |
35 | + { |
36 | drizzle_test_error("returned %s (%d)", drizzle_con_error(con), ret); |
37 | + } |
38 | |
39 | case SERVER_STATE_HANDSHAKE_READ: |
40 | drizzle_test("drizzle_handshake_client_read"); |
41 | @@ -223,7 +230,9 @@ |
42 | return; |
43 | } |
44 | else if (ret != DRIZZLE_RETURN_OK) |
45 | + { |
46 | drizzle_test_error("returned %s (%d)", drizzle_con_error(con), ret); |
47 | + } |
48 | |
49 | drizzle_test("drizzle_result_create"); |
50 | if (drizzle_result_create(con, &state->result) == NULL) |
51 | |
52 | === modified file 'libdrizzle-1.0/t/drizzle_column_st.c' |
53 | --- libdrizzle-1.0/t/drizzle_column_st.c 2011-12-14 20:53:40 +0000 |
54 | +++ libdrizzle-1.0/t/drizzle_column_st.c 2011-12-16 07:15:29 +0000 |
55 | @@ -57,31 +57,43 @@ |
56 | |
57 | drizzle_test("drizzle_create"); |
58 | if ((drizzle= drizzle_create(NULL)) == NULL) |
59 | + { |
60 | drizzle_test_error("returned NULL"); |
61 | + } |
62 | |
63 | drizzle_test("drizzle_con_create"); |
64 | if ((con= drizzle_con_create(drizzle, NULL)) == NULL) |
65 | + { |
66 | drizzle_test_error("returned NULL"); |
67 | + } |
68 | |
69 | drizzle_test("drizzle_result_create"); |
70 | if ((result= drizzle_result_create(con, NULL)) == NULL) |
71 | + { |
72 | drizzle_test_error("returned NULL"); |
73 | + } |
74 | |
75 | drizzle_test("drizzle_column_create buffer"); |
76 | if ((column= drizzle_column_create(result, &column_buffer)) == NULL) |
77 | + { |
78 | drizzle_test_error("returned NULL"); |
79 | + } |
80 | drizzle_column_free(column); |
81 | |
82 | drizzle_test("drizzle_column_create"); |
83 | if ((column= drizzle_column_create(result, NULL)) == NULL) |
84 | + { |
85 | drizzle_test_error("returned NULL"); |
86 | + } |
87 | |
88 | drizzle_test("drizzle_column_set_catalog"); |
89 | drizzle_column_set_catalog(column, "simple test"); |
90 | |
91 | drizzle_test("drizzle_column_catalog"); |
92 | if (strcmp(drizzle_column_catalog(column), "simple test")) |
93 | + { |
94 | drizzle_test_error("does not match what was set"); |
95 | + } |
96 | |
97 | drizzle_test("drizzle_column_free"); |
98 | drizzle_column_free(column); |
99 | |
100 | === modified file 'libdrizzle/column.cc' |
101 | --- libdrizzle/column.cc 2011-12-08 17:37:11 +0000 |
102 | +++ libdrizzle/column.cc 2011-12-16 07:15:29 +0000 |
103 | @@ -1,5 +1,6 @@ |
104 | -/* |
105 | - * Drizzle Client & Protocol Library |
106 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
107 | + * |
108 | + * Drizzle Client & Protocol Library |
109 | * |
110 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
111 | * All rights reserved. |
112 | @@ -410,6 +411,7 @@ |
113 | |
114 | if (result->column_list) |
115 | result->column_list->prev= column; |
116 | + |
117 | column->next= result->column_list; |
118 | result->column_list= column; |
119 | |
120 | @@ -420,14 +422,16 @@ |
121 | { |
122 | if (column->result->column_list == column) |
123 | column->result->column_list= column->next; |
124 | + |
125 | if (column->prev) |
126 | column->prev->next= column->next; |
127 | + |
128 | if (column->next) |
129 | column->next->prev= column->prev; |
130 | |
131 | if (column->options & DRIZZLE_COLUMN_ALLOCATED) |
132 | { |
133 | - delete [] column; |
134 | + delete column; |
135 | } |
136 | } |
137 | |
138 | @@ -535,14 +539,14 @@ |
139 | |
140 | drizzle_return_t drizzle_column_skip_all(drizzle_result_st *result) |
141 | { |
142 | - drizzle_return_t ret; |
143 | - uint16_t it; |
144 | + for (uint16_t it= 1; it <= result->column_count; it++) |
145 | + { |
146 | + drizzle_return_t ret= drizzle_column_skip(result); |
147 | |
148 | - for (it= 1; it <= result->column_count; it++) |
149 | - { |
150 | - ret= drizzle_column_skip(result); |
151 | if (ret != DRIZZLE_RETURN_OK) |
152 | + { |
153 | return ret; |
154 | + } |
155 | } |
156 | |
157 | return DRIZZLE_RETURN_OK; |
158 | @@ -561,6 +565,7 @@ |
159 | } |
160 | |
161 | *ret_ptr= drizzle_state_loop(result->con); |
162 | + |
163 | return result->column; |
164 | } |
165 | |
166 | @@ -601,7 +606,9 @@ |
167 | drizzle_column_st *drizzle_column_next(drizzle_result_st *result) |
168 | { |
169 | if (result->column_current == result->column_count) |
170 | + { |
171 | return NULL; |
172 | + } |
173 | |
174 | result->column_current++; |
175 | return &(result->column_buffer[result->column_current - 1]); |
176 | @@ -610,7 +617,9 @@ |
177 | drizzle_column_st *drizzle_column_prev(drizzle_result_st *result) |
178 | { |
179 | if (result->column_current == 0) |
180 | + { |
181 | return NULL; |
182 | + } |
183 | |
184 | result->column_current--; |
185 | return &(result->column_buffer[result->column_current]); |
186 | @@ -619,14 +628,18 @@ |
187 | void drizzle_column_seek(drizzle_result_st *result, uint16_t column) |
188 | { |
189 | if (column <= result->column_count) |
190 | + { |
191 | result->column_current= column; |
192 | + } |
193 | } |
194 | |
195 | drizzle_column_st *drizzle_column_index(drizzle_result_st *result, |
196 | uint16_t column) |
197 | { |
198 | if (column >= result->column_count) |
199 | + { |
200 | return NULL; |
201 | + } |
202 | |
203 | return &(result->column_buffer[column]); |
204 | } |
205 | @@ -656,7 +669,9 @@ |
206 | void drizzle_column_set_catalog(drizzle_column_st *column, const char *catalog) |
207 | { |
208 | if (catalog == NULL) |
209 | + { |
210 | column->catalog[0]= 0; |
211 | + } |
212 | else |
213 | { |
214 | strncpy(column->catalog, catalog, DRIZZLE_MAX_CATALOG_SIZE); |
215 | @@ -667,7 +682,9 @@ |
216 | void drizzle_column_set_db(drizzle_column_st *column, const char *db) |
217 | { |
218 | if (db == NULL) |
219 | + { |
220 | column->db[0]= 0; |
221 | + } |
222 | else |
223 | { |
224 | strncpy(column->db, db, DRIZZLE_MAX_DB_SIZE); |
225 | @@ -678,7 +695,9 @@ |
226 | void drizzle_column_set_table(drizzle_column_st *column, const char *table) |
227 | { |
228 | if (table == NULL) |
229 | + { |
230 | column->table[0]= 0; |
231 | + } |
232 | else |
233 | { |
234 | strncpy(column->table, table, DRIZZLE_MAX_TABLE_SIZE); |
235 | @@ -690,7 +709,9 @@ |
236 | const char *orig_table) |
237 | { |
238 | if (orig_table == NULL) |
239 | + { |
240 | column->orig_table[0]= 0; |
241 | + } |
242 | else |
243 | { |
244 | strncpy(column->orig_table, orig_table, DRIZZLE_MAX_TABLE_SIZE); |
245 | @@ -701,7 +722,9 @@ |
246 | void drizzle_column_set_name(drizzle_column_st *column, const char *name) |
247 | { |
248 | if (name == NULL) |
249 | + { |
250 | column->name[0]= 0; |
251 | + } |
252 | else |
253 | { |
254 | strncpy(column->name, name, DRIZZLE_MAX_COLUMN_NAME_SIZE); |
255 | |
256 | === modified file 'libdrizzle/command.cc' |
257 | --- libdrizzle/command.cc 2011-12-08 17:37:11 +0000 |
258 | +++ libdrizzle/command.cc 2011-12-16 07:15:29 +0000 |
259 | @@ -1,4 +1,5 @@ |
260 | -/* |
261 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
262 | + * |
263 | * Drizzle Client & Protocol Library |
264 | * |
265 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
266 | |
267 | === modified file 'libdrizzle/conn.cc' |
268 | --- libdrizzle/conn.cc 2011-12-08 17:37:11 +0000 |
269 | +++ libdrizzle/conn.cc 2011-12-16 07:15:29 +0000 |
270 | @@ -1,4 +1,5 @@ |
271 | -/* |
272 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
273 | + * |
274 | * Drizzle Client & Protocol Library |
275 | * |
276 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
277 | |
278 | === modified file 'libdrizzle/conn_uds.cc' |
279 | --- libdrizzle/conn_uds.cc 2011-12-08 17:37:11 +0000 |
280 | +++ libdrizzle/conn_uds.cc 2011-12-16 07:15:29 +0000 |
281 | @@ -1,4 +1,5 @@ |
282 | -/* |
283 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
284 | + * |
285 | * Drizzle Client & Protocol Library |
286 | * |
287 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
288 | |
289 | === modified file 'libdrizzle/drizzle.cc' |
290 | --- libdrizzle/drizzle.cc 2011-12-08 17:37:11 +0000 |
291 | +++ libdrizzle/drizzle.cc 2011-12-16 07:15:29 +0000 |
292 | @@ -1,4 +1,5 @@ |
293 | -/* |
294 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
295 | + * |
296 | * Drizzle Client & Protocol Library |
297 | * |
298 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
299 | @@ -178,7 +179,9 @@ |
300 | free(drizzle->pfds); |
301 | |
302 | if (drizzle->options & DRIZZLE_ALLOCATED) |
303 | - free(drizzle); |
304 | + { |
305 | + delete drizzle; |
306 | + } |
307 | #if defined(_WIN32) |
308 | /* if it is MS windows, invoke WSACleanup() at the end*/ |
309 | WSACleanup(); |
310 | @@ -406,7 +409,9 @@ |
311 | con->drizzle->con_count--; |
312 | |
313 | if (con->options & DRIZZLE_CON_ALLOCATED) |
314 | - free(con); |
315 | + { |
316 | + delete con; |
317 | + } |
318 | } |
319 | |
320 | void drizzle_con_free_all(drizzle_st *drizzle) |
321 | |
322 | === modified file 'libdrizzle/field.cc' |
323 | --- libdrizzle/field.cc 2011-12-08 17:37:11 +0000 |
324 | +++ libdrizzle/field.cc 2011-12-16 07:15:29 +0000 |
325 | @@ -1,4 +1,5 @@ |
326 | -/* |
327 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
328 | + * |
329 | * Drizzle Client & Protocol Library |
330 | * |
331 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
332 | @@ -61,7 +62,7 @@ |
333 | } |
334 | |
335 | *ret_ptr= drizzle_state_loop(result->con); |
336 | - if (*ret_ptr == DRIZZLE_RETURN_OK && |
337 | + if (*ret_ptr == DRIZZLE_RETURN_OK and |
338 | result->options & DRIZZLE_RESULT_ROW_BREAK) |
339 | { |
340 | *ret_ptr= DRIZZLE_RETURN_ROW_BREAK; |
341 | @@ -77,13 +78,15 @@ |
342 | drizzle_field_t drizzle_field_buffer(drizzle_result_st *result, size_t *total, |
343 | drizzle_return_t *ret_ptr) |
344 | { |
345 | - drizzle_field_t field; |
346 | size_t offset= 0; |
347 | size_t size= 0; |
348 | |
349 | - field= drizzle_field_read(result, &offset, &size, total, ret_ptr); |
350 | + drizzle_field_t field= drizzle_field_read(result, &offset, &size, total, ret_ptr); |
351 | + |
352 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
353 | + { |
354 | return NULL; |
355 | + } |
356 | |
357 | if (field == NULL) |
358 | { |
359 | @@ -108,7 +111,9 @@ |
360 | { |
361 | field= drizzle_field_read(result, &offset, &size, total, ret_ptr); |
362 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
363 | + { |
364 | return NULL; |
365 | + } |
366 | |
367 | memcpy(result->field_buffer + offset, field, size); |
368 | } |
369 | @@ -122,7 +127,10 @@ |
370 | |
371 | void drizzle_field_free(drizzle_field_t field) |
372 | { |
373 | - free(field); |
374 | + if (field) |
375 | + { |
376 | + free(field); |
377 | + } |
378 | } |
379 | |
380 | /* |
381 | @@ -287,7 +295,9 @@ |
382 | drizzle_log_debug(con->drizzle, "drizzle_state_field_write"); |
383 | |
384 | if (result->field == NULL && result->field_total != 0) |
385 | + { |
386 | return DRIZZLE_RETURN_PAUSE; |
387 | + } |
388 | |
389 | free_size= (size_t)DRIZZLE_MAX_BUFFER_SIZE - (size_t)(start - con->buffer); |
390 | ptr= start; |
391 | @@ -335,7 +345,9 @@ |
392 | result->field= NULL; |
393 | |
394 | if (result->field_offset == result->field_total) |
395 | + { |
396 | drizzle_state_pop(con); |
397 | + } |
398 | else if (con->packet_size == 0) |
399 | { |
400 | con->result->options|= DRIZZLE_RESULT_ROW_BREAK; |
401 | @@ -343,11 +355,14 @@ |
402 | } |
403 | |
404 | drizzle_state_push(con, drizzle_state_write); |
405 | + |
406 | return DRIZZLE_RETURN_OK; |
407 | } |
408 | |
409 | if (result->field_size == 0) |
410 | + { |
411 | drizzle_state_pop(con); |
412 | + } |
413 | else |
414 | { |
415 | if (result->field_size < free_size) |
416 | |
417 | === modified file 'libdrizzle/handshake.cc' |
418 | --- libdrizzle/handshake.cc 2011-12-08 17:37:11 +0000 |
419 | +++ libdrizzle/handshake.cc 2011-12-16 07:15:29 +0000 |
420 | @@ -1,4 +1,5 @@ |
421 | -/* |
422 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
423 | + * |
424 | * Drizzle Client & Protocol Library |
425 | * |
426 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
427 | |
428 | === modified file 'libdrizzle/mysql_password_hash.cc' |
429 | --- libdrizzle/mysql_password_hash.cc 2011-12-08 17:37:11 +0000 |
430 | +++ libdrizzle/mysql_password_hash.cc 2011-12-16 07:15:29 +0000 |
431 | @@ -1,4 +1,5 @@ |
432 | -/* |
433 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
434 | + * |
435 | * Drizzle Client & Protocol Library |
436 | * |
437 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
438 | |
439 | === modified file 'libdrizzle/pack.cc' |
440 | --- libdrizzle/pack.cc 2011-12-08 17:37:11 +0000 |
441 | +++ libdrizzle/pack.cc 2011-12-16 07:15:29 +0000 |
442 | @@ -1,4 +1,5 @@ |
443 | -/* |
444 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
445 | + * |
446 | * Drizzle Client & Protocol Library |
447 | * |
448 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
449 | |
450 | === modified file 'libdrizzle/query.cc' |
451 | --- libdrizzle/query.cc 2011-12-08 17:37:11 +0000 |
452 | +++ libdrizzle/query.cc 2011-12-16 07:15:29 +0000 |
453 | @@ -1,4 +1,5 @@ |
454 | -/* |
455 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
456 | + * |
457 | * Drizzle Client & Protocol Library |
458 | * |
459 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
460 | @@ -136,13 +137,17 @@ |
461 | query->drizzle->query_count--; |
462 | |
463 | if (query->options & DRIZZLE_QUERY_ALLOCATED) |
464 | - free(query); |
465 | + { |
466 | + delete query; |
467 | + } |
468 | } |
469 | |
470 | void drizzle_query_free_all(drizzle_st *drizzle) |
471 | { |
472 | while (drizzle->query_list != NULL) |
473 | + { |
474 | drizzle_query_free(drizzle->query_list); |
475 | + } |
476 | } |
477 | |
478 | drizzle_con_st *drizzle_query_con(drizzle_query_st *query) |
479 | |
480 | === modified file 'libdrizzle/result.cc' |
481 | --- libdrizzle/result.cc 2011-12-08 17:37:11 +0000 |
482 | +++ libdrizzle/result.cc 2011-12-16 07:15:29 +0000 |
483 | @@ -1,4 +1,5 @@ |
484 | -/* |
485 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
486 | + * |
487 | * Drizzle Client & Protocol Library |
488 | * |
489 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
490 | @@ -114,20 +115,19 @@ |
491 | return; |
492 | } |
493 | |
494 | - drizzle_column_st *column; |
495 | - uint64_t x; |
496 | - |
497 | - for (column= result->column_list; column != NULL; column= result->column_list) |
498 | + for (drizzle_column_st* column= result->column_list; column != NULL; column= result->column_list) |
499 | { |
500 | drizzle_column_free(column); |
501 | } |
502 | |
503 | - free(result->column_buffer); |
504 | + delete [] result->column_buffer; |
505 | |
506 | if (result->options & DRIZZLE_RESULT_BUFFER_ROW) |
507 | { |
508 | - for (x= 0; x < result->row_count; x++) |
509 | + for (uint64_t x= 0; x < result->row_count; x++) |
510 | + { |
511 | drizzle_row_free(result, result->row_list[x]); |
512 | + } |
513 | |
514 | free(result->row_list); |
515 | free(result->field_sizes_list); |
516 | @@ -151,7 +151,7 @@ |
517 | |
518 | if (result->options & DRIZZLE_RESULT_ALLOCATED) |
519 | { |
520 | - free(result); |
521 | + delete result; |
522 | } |
523 | } |
524 | |
525 | @@ -433,8 +433,6 @@ |
526 | const drizzle_field_t *field, |
527 | const size_t *size) |
528 | { |
529 | - uint16_t x; |
530 | - |
531 | if (result == NULL) |
532 | { |
533 | return; |
534 | @@ -442,18 +440,28 @@ |
535 | |
536 | result->con->packet_size= 0; |
537 | |
538 | - for (x= 0; x < result->column_count; x++) |
539 | + for (uint16_t x= 0; x < result->column_count; x++) |
540 | { |
541 | if (field[x] == NULL) |
542 | + { |
543 | result->con->packet_size++; |
544 | + } |
545 | else if (size[x] < 251) |
546 | + { |
547 | result->con->packet_size+= (1 + size[x]); |
548 | + } |
549 | else if (size[x] < 65536) |
550 | + { |
551 | result->con->packet_size+= (3 + size[x]); |
552 | + } |
553 | else if (size[x] < 16777216) |
554 | + { |
555 | result->con->packet_size+= (4 + size[x]); |
556 | + } |
557 | else |
558 | + { |
559 | result->con->packet_size+= (9 + size[x]); |
560 | + } |
561 | } |
562 | } |
563 | |
564 | |
565 | === modified file 'libdrizzle/row.cc' |
566 | --- libdrizzle/row.cc 2011-12-08 17:37:11 +0000 |
567 | +++ libdrizzle/row.cc 2011-12-16 07:15:29 +0000 |
568 | @@ -1,5 +1,6 @@ |
569 | -/* |
570 | - * Drizzle Client & Protocol Library |
571 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
572 | + * |
573 | + * Drizzle Client & Protocol Library |
574 | * |
575 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |
576 | * All rights reserved. |
577 | @@ -75,7 +76,9 @@ |
578 | if (result->row == NULL) |
579 | { |
580 | if (drizzle_row_read(result, ret_ptr) == 0 || *ret_ptr != DRIZZLE_RETURN_OK) |
581 | + { |
582 | return NULL; |
583 | + } |
584 | |
585 | result->row= (drizzle_row_t)malloc((sizeof(drizzle_field_t) + sizeof(size_t)) * result->column_count); |
586 | if (result->row == NULL) |
587 | @@ -93,6 +96,7 @@ |
588 | field= drizzle_field_buffer(result, &total, ret_ptr); |
589 | if (*ret_ptr == DRIZZLE_RETURN_ROW_END) |
590 | break; |
591 | + |
592 | if (*ret_ptr != DRIZZLE_RETURN_OK) |
593 | { |
594 | if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT) |
595 | @@ -118,10 +122,10 @@ |
596 | |
597 | void drizzle_row_free(drizzle_result_st *result, drizzle_row_t row) |
598 | { |
599 | - uint16_t x; |
600 | - |
601 | - for (x= 0; x < result->column_count; x++) |
602 | - drizzle_field_free(row[x]); |
603 | + for (uint16_t x= 0; x < result->column_count; x++) |
604 | + { |
605 | + drizzle_field_free(row[x]); |
606 | + } |
607 | |
608 | free(row); |
609 | } |
610 | |
611 | === modified file 'libdrizzle/state.cc' |
612 | --- libdrizzle/state.cc 2011-12-08 17:37:11 +0000 |
613 | +++ libdrizzle/state.cc 2011-12-16 07:15:29 +0000 |
614 | @@ -1,4 +1,5 @@ |
615 | -/* |
616 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
617 | + * |
618 | * Drizzle Client & Protocol Library |
619 | * |
620 | * Copyright (C) 2008 Eric Day (eday@oddments.org) |