You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Ganesh Murthy (JIRA)" <ji...@apache.org> on 2017/03/09 19:52:38 UTC
[jira] [Resolved] (DISPATCH-647) Coverity scan reported memory
leaks in Qpid Dispatch master
[ https://issues.apache.org/jira/browse/DISPATCH-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ganesh Murthy resolved DISPATCH-647.
------------------------------------
Resolution: Fixed
Fix Version/s: 0.8.0
> Coverity scan reported memory leaks in Qpid Dispatch master
> -----------------------------------------------------------
>
> Key: DISPATCH-647
> URL: https://issues.apache.org/jira/browse/DISPATCH-647
> Project: Qpid Dispatch
> Issue Type: Bug
> Components: Container
> Affects Versions: 0.8.0
> Reporter: Ganesh Murthy
> Assignee: Ganesh Murthy
> Fix For: 0.8.0
>
>
> ** CID 142259: Memory - corruptions (USE_AFTER_FREE)
> /home/kgiusti/tmp/qpid-dispatch/src/posix/driver.c: 836 in qdpn_driver_free()
> ________________________________________________________________________________________________________
> *** CID 142259: Memory - corruptions (USE_AFTER_FREE)
> /home/kgiusti/tmp/qpid-dispatch/src/posix/driver.c: 836 in qdpn_driver_free()
> 830 void qdpn_driver_free(qdpn_driver_t *d)
> 831 {
> 832 if (!d) return;
> 833
> 834 close(d->efd);
> 835 while (DEQ_HEAD(d->connectors))
> >>> CID 142259: Memory - corruptions (USE_AFTER_FREE)
> >>> Calling "qdpn_connector_free" frees pointer "d->connectors.head" which has already been freed.
> 836 qdpn_connector_free(DEQ_HEAD(d->connectors));
> 837 while (DEQ_HEAD(d->listeners))
> 838 qdpn_listener_free(DEQ_HEAD(d->listeners));
> 839 free(d->fds);
> 840 sys_mutex_free(d->lock);
> 841 free(d);
> ** CID 142258: Uninitialized variables (UNINIT)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 192 in print_parsed_field()
> ________________________________________________________________________________________________________
> *** CID 142258: Uninitialized variables (UNINIT)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 192 in print_parsed_field()
> 186 if (timestamp_length > 0) {
> 187 // Gather the timestamp bytes into the timestamp_bytes array, so we process them later into time.
> 188 timestamp_bytes[--timestamp_length] = byte;
> 189 }
> 190 }
> 191
> >>> CID 142258: Uninitialized variables (UNINIT)
> >>> Using uninitialized element of array "timestamp_bytes" when calling "memcpy".
> 192 memcpy(&creation_timestamp, timestamp_bytes, 8);
> 193 if (creation_timestamp > 0) {
> 194 format_time(creation_timestamp, "%Y-%m-%d %H:%M:%S.%%03lu %z", creation_time, 100);
> 195 aprintf(begin, end, "%s", creation_time);
> 196 }
> 197 break;
> ** CID 142257: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 142 in test_trim()
> ________________________________________________________________________________________________________
> *** CID 142257: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 142 in test_trim()
> 136 static char *test_trim(void *context)
> 137 {
> 138 qd_iterator_t *iter = qd_iterator_string("testing.trim", ITER_VIEW_ALL);
> 139
> 140 qd_iterator_trim_view(iter, 7);
> 141 if (!qd_iterator_equal(iter, (unsigned char*) "testing"))
> >>> CID 142257: Resource leaks (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 142 return "Trim on ITER_VIEW_ALL failed (1)";
> 143
> 144 qd_iterator_reset_view(iter, ITER_VIEW_ALL);
> 145 if (!qd_iterator_equal(iter, (unsigned char*) "testing.trim"))
> 146 return "Trim on ITER_VIEW_ALL failed (2)";
> 147
> ** CID 142256: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> ________________________________________________________________________________________________________
> *** CID 142256: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> 187 qd_iterator_t *sub1 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 188 qd_iterator_advance(iter, 5);
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> >>> CID 142256: Resource leaks (RESOURCE_LEAK)
> >>> Variable "sub3" going out of scope leaks the storage it points to.
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> ** CID 142255: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 151 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 161 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 170 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 183 in test_map()
> ________________________________________________________________________________________________________
> *** CID 142255: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 151 in test_map()
> 145 }
> 146
> 147 qd_parsed_field_t *key_field = qd_parse_sub_key(field, 0);
> 148 qd_iterator_t *key_iter = qd_parse_raw(key_field);
> 149 qd_iterator_t *typed_iter = qd_parse_typed(key_field);
> 150 if (!qd_iterator_equal(key_iter, (unsigned char*) "first")) {
> >>> CID 142255: (RESOURCE_LEAK)
> >>> Failing to save or free storage allocated by "qd_iterator_copy(key_iter)" leaks it.
> 151 snprintf(error, 1000, "First key: expected 'first', got '%s'", qd_iterator_copy(key_iter));
> 152 return error;
> 153 }
> 154 if (!qd_iterator_equal(typed_iter, (unsigned char*) "\xa3\x05\x66irst"))
> 155 return "Incorrect typed iterator on first-key";
> 156
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 161 in test_map()
> 155 return "Incorrect typed iterator on first-key";
> 156
> 157 qd_parsed_field_t *val_field = qd_parse_sub_value(field, 0);
> 158 qd_iterator_t *val_iter = qd_parse_raw(val_field);
> 159 typed_iter = qd_parse_typed(val_field);
> 160 if (!qd_iterator_equal(val_iter, (unsigned char*) "value_of_first")) {
> >>> CID 142255: (RESOURCE_LEAK)
> >>> Failing to save or free storage allocated by "qd_iterator_copy(val_iter)" leaks it.
> 161 snprintf(error, 1000, "First value: expected 'value_of_first', got '%s'", qd_iterator_copy(val_iter));
> 162 return error;
> 163 }
> 164 if (!qd_iterator_equal(typed_iter, (unsigned char*) "\xa1\x0evalue_of_first"))
> 165 return "Incorrect typed iterator on first-key";
> 166
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 170 in test_map()
> 164 if (!qd_iterator_equal(typed_iter, (unsigned char*) "\xa1\x0evalue_of_first"))
> 165 return "Incorrect typed iterator on first-key";
> 166
> 167 key_field = qd_parse_sub_key(field, 1);
> 168 key_iter = qd_parse_raw(key_field);
> 169 if (!qd_iterator_equal(key_iter, (unsigned char*) "second")) {
> >>> CID 142255: (RESOURCE_LEAK)
> >>> Failing to save or free storage allocated by "qd_iterator_copy(key_iter)" leaks it.
> 170 snprintf(error, 1000, "Second key: expected 'second', got '%s'", qd_iterator_copy(key_iter));
> 171 return error;
> 172 }
> 173
> 174 val_field = qd_parse_sub_value(field, 1);
> 175 if (qd_parse_as_uint(val_field) != 32) {
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 183 in test_map()
> 177 return error;
> 178 }
> 179
> 180 key_field = qd_parse_sub_key(field, 2);
> 181 key_iter = qd_parse_raw(key_field);
> 182 if (!qd_iterator_equal(key_iter, (unsigned char*) "third")) {
> >>> CID 142255: (RESOURCE_LEAK)
> >>> Failing to save or free storage allocated by "qd_iterator_copy(key_iter)" leaks it.
> 183 snprintf(error, 1000, "Third key: expected 'third', got '%s'", qd_iterator_copy(key_iter));
> 184 return error;
> 185 }
> 186
> 187 val_field = qd_parse_sub_value(field, 2);
> 188 if (!qd_parse_as_bool(val_field)) {
> ** CID 142254: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> ________________________________________________________________________________________________________
> *** CID 142254: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> 308
> 309 qd_parsed_field_t *parsed_field = qd_parse(iter);
> 310
> 311 // If there is a problem with parsing a field, just return
> 312 if (!qd_parse_ok(parsed_field)) {
> 313 aprintf(begin, end, "%s", post);
> >>> CID 142254: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 314 return;
> 315 }
> 316
> 317 print_parsed_field(parsed_field, begin, end, max);
> 318
> 319 aprintf(begin, end, "%s", post);
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> 308
> 309 qd_parsed_field_t *parsed_field = qd_parse(iter);
> 310
> 311 // If there is a problem with parsing a field, just return
> 312 if (!qd_parse_ok(parsed_field)) {
> 313 aprintf(begin, end, "%s", post);
> >>> CID 142254: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 314 return;
> 315 }
> 316
> 317 print_parsed_field(parsed_field, begin, end, max);
> 318
> 319 aprintf(begin, end, "%s", post);
> ** CID 142253: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 195 in test_sub_iterator()
> ________________________________________________________________________________________________________
> *** CID 142253: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> 187 qd_iterator_t *sub1 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 188 qd_iterator_advance(iter, 5);
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> >>> CID 142253: (RESOURCE_LEAK)
> >>> Variable "sub1" going out of scope leaks the storage it points to.
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 195 in test_sub_iterator()
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> >>> CID 142253: (RESOURCE_LEAK)
> >>> Variable "sub1" going out of scope leaks the storage it points to.
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> 199 qd_iterator_free(iter);
> 200 qd_iterator_free(sub1);
> ** CID 142252: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 342 in test_view_address_with_space()
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 343 in test_view_address_with_space()
> ________________________________________________________________________________________________________
> *** CID 142252: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 342 in test_view_address_with_space()
> 336 qd_iterator_t *iter = qd_iterator_buffer(DEQ_HEAD(chain), 0,
> 337 strlen(cases[idx].addr),
> 338 ITER_VIEW_ADDRESS_WITH_SPACE);
> 339 qd_iterator_annotate_space(iter, "space/", 6);
> 340 char *ret = view_address_hash(context, iter, cases[idx].addr, cases[idx].view);
> 341 release_buffer_chain(&chain);
> >>> CID 142252: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 342 if (ret) return ret;
> 343 }
> 344
> 345 return 0;
> 346 }
> 347
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 343 in test_view_address_with_space()
> 337 strlen(cases[idx].addr),
> 338 ITER_VIEW_ADDRESS_WITH_SPACE);
> 339 qd_iterator_annotate_space(iter, "space/", 6);
> 340 char *ret = view_address_hash(context, iter, cases[idx].addr, cases[idx].view);
> 341 release_buffer_chain(&chain);
> 342 if (ret) return ret;
> >>> CID 142252: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 343 }
> 344
> 345 return 0;
> 346 }
> 347
> 348
> ** CID 142251: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 195 in test_sub_iterator()
> ________________________________________________________________________________________________________
> *** CID 142251: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> 187 qd_iterator_t *sub1 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 188 qd_iterator_advance(iter, 5);
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> >>> CID 142251: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 195 in test_sub_iterator()
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> >>> CID 142251: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> 199 qd_iterator_free(iter);
> 200 qd_iterator_free(sub1);
> ** CID 142250: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 397 in test_view_address_hash_with_space()
> ________________________________________________________________________________________________________
> *** CID 142250: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 397 in test_view_address_hash_with_space()
> 391 qd_iterator_annotate_space(iter, "test.vhost.", 11);
> 392 if (!qd_iterator_equal(iter, (unsigned char*) cases[idx].view)) {
> 393 char *got = (char*) qd_iterator_copy(iter);
> 394 snprintf(fail_text, FAIL_TEXT_SIZE, "Addr '%s' failed. Expected '%s', got '%s' (len: %d)",
> 395 cases[idx].addr, cases[idx].view, got, qd_iterator_length(iter));
> 396 free(got);
> >>> CID 142250: Resource leaks (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 397 return fail_text;
> 398 }
> 399 qd_iterator_free(iter);
> 400 }
> 401
> 402 return 0;
> ** CID 142249: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> ________________________________________________________________________________________________________
> *** CID 142249: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/src/message.c: 314 in print_field()
> 308
> 309 qd_parsed_field_t *parsed_field = qd_parse(iter);
> 310
> 311 // If there is a problem with parsing a field, just return
> 312 if (!qd_parse_ok(parsed_field)) {
> 313 aprintf(begin, end, "%s", post);
> >>> CID 142249: Resource leaks (RESOURCE_LEAK)
> >>> Variable "parsed_field" going out of scope leaks the storage it points to.
> 314 return;
> 315 }
> 316
> 317 print_parsed_field(parsed_field, begin, end, max);
> 318
> 319 aprintf(begin, end, "%s", post);
> ** CID 142248: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 135 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 139 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 144 in test_map()
> ________________________________________________________________________________________________________
> *** CID 142248: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 135 in test_map()
> 129 int data_len = 50;
> 130
> 131 qd_iterator_t *data_iter = qd_iterator_binary(data, data_len, ITER_VIEW_ALL);
> 132 qd_parsed_field_t *field = qd_parse(data_iter);
> 133 if (!qd_parse_ok(field)) {
> 134 snprintf(error, 1000, "Parse failed: %s", qd_parse_error(field));
> >>> CID 142248: (RESOURCE_LEAK)
> >>> Variable "field" going out of scope leaks the storage it points to.
> 135 return error;
> 136 }
> 137
> 138 if (!qd_parse_is_map(field))
> 139 return "Expected field to be a map";
> 140
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 139 in test_map()
> 133 if (!qd_parse_ok(field)) {
> 134 snprintf(error, 1000, "Parse failed: %s", qd_parse_error(field));
> 135 return error;
> 136 }
> 137
> 138 if (!qd_parse_is_map(field))
> >>> CID 142248: (RESOURCE_LEAK)
> >>> Variable "field" going out of scope leaks the storage it points to.
> 139 return "Expected field to be a map";
> 140
> 141 uint32_t count = qd_parse_sub_count(field);
> 142 if (count != 3) {
> 143 snprintf(error, 1000, "Expected sub-count==3, got %"PRIu32, count);
> 144 return error;
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 144 in test_map()
> 138 if (!qd_parse_is_map(field))
> 139 return "Expected field to be a map";
> 140
> 141 uint32_t count = qd_parse_sub_count(field);
> 142 if (count != 3) {
> 143 snprintf(error, 1000, "Expected sub-count==3, got %"PRIu32, count);
> >>> CID 142248: (RESOURCE_LEAK)
> >>> Variable "field" going out of scope leaks the storage it points to.
> 144 return error;
> 145 }
> 146
> 147 qd_parsed_field_t *key_field = qd_parse_sub_key(field, 0);
> 148 qd_iterator_t *key_iter = qd_parse_raw(key_field);
> 149 qd_iterator_t *typed_iter = qd_parse_typed(key_field);
> ** CID 142247: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 917 in test_prefix_hash_with_space()
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 920 in test_prefix_hash_with_space()
> ________________________________________________________________________________________________________
> *** CID 142247: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 917 in test_prefix_hash_with_space()
> 911 qd_hash_retrieve_prefihash, iter, &ptr);
> 912 int position = (int) ((long) ptr);
> 913 position--;
> 914 if (position != patterns[idx].entry) {
> 915 snprintf(error, 200, "Pattern: '%s', expected %d, got %d",
> 916 patterns[idx].pattern, patterns[idx].entry, position);
> >>> CID 142247: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 917 return error;
> 918 }
> 919 idx++;
> 920 }
> 921
> 922 return 0;
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 920 in test_prefix_hash_with_space()
> 914 if (position != patterns[idx].entry) {
> 915 snprintf(error, 200, "Pattern: '%s', expected %d, got %d",
> 916 patterns[idx].pattern, patterns[idx].entry, position);
> 917 return error;
> 918 }
> 919 idx++;
> >>> CID 142247: (RESOURCE_LEAK)
> >>> Variable "iter" going out of scope leaks the storage it points to.
> 920 }
> 921
> 922 return 0;
> 923 }
> 924
> 925
> ** CID 142246: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 135 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 139 in test_map()
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 144 in test_map()
> ________________________________________________________________________________________________________
> *** CID 142246: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 135 in test_map()
> 129 int data_len = 50;
> 130
> 131 qd_iterator_t *data_iter = qd_iterator_binary(data, data_len, ITER_VIEW_ALL);
> 132 qd_parsed_field_t *field = qd_parse(data_iter);
> 133 if (!qd_parse_ok(field)) {
> 134 snprintf(error, 1000, "Parse failed: %s", qd_parse_error(field));
> >>> CID 142246: (RESOURCE_LEAK)
> >>> Variable "data_iter" going out of scope leaks the storage it points to.
> 135 return error;
> 136 }
> 137
> 138 if (!qd_parse_is_map(field))
> 139 return "Expected field to be a map";
> 140
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 139 in test_map()
> 133 if (!qd_parse_ok(field)) {
> 134 snprintf(error, 1000, "Parse failed: %s", qd_parse_error(field));
> 135 return error;
> 136 }
> 137
> 138 if (!qd_parse_is_map(field))
> >>> CID 142246: (RESOURCE_LEAK)
> >>> Variable "data_iter" going out of scope leaks the storage it points to.
> 139 return "Expected field to be a map";
> 140
> 141 uint32_t count = qd_parse_sub_count(field);
> 142 if (count != 3) {
> 143 snprintf(error, 1000, "Expected sub-count==3, got %"PRIu32, count);
> 144 return error;
> /home/kgiusti/tmp/qpid-dispatch/tests/parse_test.c: 144 in test_map()
> 138 if (!qd_parse_is_map(field))
> 139 return "Expected field to be a map";
> 140
> 141 uint32_t count = qd_parse_sub_count(field);
> 142 if (count != 3) {
> 143 snprintf(error, 1000, "Expected sub-count==3, got %"PRIu32, count);
> >>> CID 142246: (RESOURCE_LEAK)
> >>> Variable "data_iter" going out of scope leaks the storage it points to.
> 144 return error;
> 145 }
> 146
> 147 qd_parsed_field_t *key_field = qd_parse_sub_key(field, 0);
> 148 qd_iterator_t *key_iter = qd_parse_raw(key_field);
> 149 qd_iterator_t *typed_iter = qd_parse_typed(key_field);
> ** CID 142245: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> ________________________________________________________________________________________________________
> *** CID 142245: Resource leaks (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 193 in test_sub_iterator()
> 187 qd_iterator_t *sub1 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 188 qd_iterator_advance(iter, 5);
> 189 qd_iterator_t *sub2 = qd_iterator_sub(iter, qd_iterator_remaining(iter));
> 190 qd_iterator_t *sub3 = qd_iterator_sub(iter, 3);
> 191
> 192 if (!qd_iterator_equal(sub1, (unsigned char*) "test_sub_iterator"))
> >>> CID 142245: Resource leaks (RESOURCE_LEAK)
> >>> Variable "sub2" going out of scope leaks the storage it points to.
> 193 return "Sub Iterator failed - 1";
> 194 if (!qd_iterator_equal(sub2, (unsigned char*) "sub_iterator"))
> 195 return "Sub Iterator failed - 2";
> 196 if (!qd_iterator_equal(sub3, (unsigned char*) "sub"))
> 197 return "Sub Iterator failed - 3";
> 198
> ** CID 142244: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 917 in test_prefix_hash_with_space()
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 922 in test_prefix_hash_with_space()
> ________________________________________________________________________________________________________
> *** CID 142244: (RESOURCE_LEAK)
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 917 in test_prefix_hash_with_space()
> 911 qd_hash_retrieve_prefihash, iter, &ptr);
> 912 int position = (int) ((long) ptr);
> 913 position--;
> 914 if (position != patterns[idx].entry) {
> 915 snprintf(error, 200, "Pattern: '%s', expected %d, got %d",
> 916 patterns[idx].pattern, patterns[idx].entry, position);
> >>> CID 142244: (RESOURCE_LEAK)
> >>> Variable "hash" going out of scope leaks the storage it points to.
> 917 return error;
> 918 }
> 919 idx++;
> 920 }
> 921
> 922 return 0;
> /home/kgiusti/tmp/qpid-dispatch/tests/field_test.c: 922 in test_prefix_hash_with_space()
> 916 patterns[idx].pattern, patterns[idx].entry, position);
> 917 return error;
> 918 }
> 919 idx++;
> 920 }
> 921
> >>> CID 142244: (RESOURCE_LEAK)
> >>> Variable "hash" going out of scope leaks the storage it points to.
> 922 return 0;
> 923 }
> 924
> 925
> 926 int field_tests(void)
> 927 {
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org