Skip to content

Commit

Permalink
fixed mac_mlme valgrind errors.
Browse files Browse the repository at this point in the history
Change-Id: I8ad1fcf264ae799a0b5221928e9aa88dec6dead3
  • Loading branch information
Juha Heiskanen authored and juhhei01 committed Mar 8, 2018
1 parent 4e2a743 commit 7db0938
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/nanostack/unittest/mac/mac_mlme/test_mac_mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,16 +1127,19 @@ bool test_mac_mlme_beacon_notify()
memset(&setup, 0, sizeof(protocol_interface_rf_mac_setup_s));
setup.tun_extension_rf_driver = NULL;
mlme_beacon_ind_t data;
memset(&data, 0, sizeof(mlme_beacon_ind_t));
mac_api_t api;
memset(&api, 0, sizeof(mac_api_t));
api.mlme_ind_cb = &mlme_ind_callback;
sw_mac_stub.mac_api_ptr = &api;
mlme_scan_conf_t conf;
memset(&conf, 0, sizeof(mlme_scan_conf_t));
setup.mac_mlme_scan_resp = &conf;

//Test add_or_update_beacon here completely -->
mlme_pan_descriptor_t desc1;
memset(&desc1, 0, sizeof(mlme_pan_descriptor_t));
conf.PAN_values[0] = &desc1;
conf.PAN_values[1] = NULL;
conf.ResultListSize = 2;
desc1.LogicalChannel = 11;
data.PANDescriptor.LogicalChannel = 11;
Expand All @@ -1147,11 +1150,13 @@ bool test_mac_mlme_beacon_notify()
// Beacon data length doesn't contain FHSS synch info on single channel
data.beacon_data_length = FHSS_SYNCH_INFO_START;

nsdynmemlib_stub.returnCounter = 0;
//for loop covered here
if(0 != mac_mlme_beacon_notify(&setup, &data)){
return false;
}

//Add First
conf.PAN_values[0] = NULL;
if(0 != mac_mlme_beacon_notify(&setup, &data)){
return false;
Expand All @@ -1170,6 +1175,8 @@ bool test_mac_mlme_beacon_notify()
}

ns_dyn_mem_free(conf.PAN_values[2]);
conf.PAN_values[2] = NULL;
conf.ResultListSize = 2;

// FHSS TESTS START
setup.fhss_api = ns_fhss_create(0, 0);
Expand Down

0 comments on commit 7db0938

Please sign in to comment.