fix memory leak
This commit is contained in:
parent
c9d34783d8
commit
0a13c2948c
16
.gitignore
vendored
16
.gitignore
vendored
@ -83,3 +83,19 @@
|
|||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
.vscode/uv4.log
|
.vscode/uv4.log
|
||||||
.vscode/uv4.log.lock
|
.vscode/uv4.log.lock
|
||||||
|
RTE/CMSIS/RTX_Config.c.update@5.1.1
|
||||||
|
RTE/CMSIS/RTX_Config.h.update@5.5.2
|
||||||
|
RTE/Compiler/EventRecorderConf.h.update@1.1.0
|
||||||
|
RTE/Device/STM32F746NGHx/RTE_Device.h.update@1.5.1
|
||||||
|
RTE/Device/STM32F746NGHx/startup_stm32f746xx.s.update@1.2.2
|
||||||
|
RTE/Device/STM32F746NGHx/stm32f7xx_hal_conf.h.update@1.2.7
|
||||||
|
RTE/Device/STM32F746NGHx/system_stm32f7xx.c.update@1.2.2
|
||||||
|
RTE/Hesso_pack/ext_buttons.c.base@1.0.0
|
||||||
|
RTE/Hesso_pack/ext_buttons.h.base@1.0.0
|
||||||
|
RTE/Hesso_pack/ext_keyboard.c.update@1.1.1
|
||||||
|
RTE/Hesso_pack/ext_keyboard.h.update@1.1.1
|
||||||
|
RTE/Hesso_pack/ext_led.c.base@1.0.0
|
||||||
|
RTE/Hesso_pack/ext_led.h.base@1.0.0
|
||||||
|
RTE/Hesso_pack/ext_uart.c.base@1.0.0
|
||||||
|
RTE/Hesso_pack/ext_uart.h.base@1.0.0
|
||||||
|
RTE/uGFX_library/gfxconf.h.update@2.0.0
|
||||||
|
18
mac_sender.c
18
mac_sender.c
@ -61,6 +61,7 @@ void MacSender(void *argument) {
|
|||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
case TOKEN: {
|
case TOKEN: {
|
||||||
// Get token and save it
|
// Get token and save it
|
||||||
|
// osDelay(300);
|
||||||
//lastToken = osMemoryPoolAlloc(memPool,osWaitForever);
|
//lastToken = osMemoryPoolAlloc(memPool,osWaitForever);
|
||||||
memcpy(lastToken, msg, TOKENSIZE-2);
|
memcpy(lastToken, msg, TOKENSIZE-2);
|
||||||
|
|
||||||
@ -73,7 +74,6 @@ void MacSender(void *argument) {
|
|||||||
// send to lcd
|
// send to lcd
|
||||||
queueMsg.type = TOKEN_LIST;
|
queueMsg.type = TOKEN_LIST;
|
||||||
memcpy(queueMsg.anyPtr , lastToken, TOKENSIZE-2);
|
memcpy(queueMsg.anyPtr , lastToken, TOKENSIZE-2);
|
||||||
//queueMsg.anyPtr = lastToken;
|
|
||||||
retCode = osMessageQueuePut(
|
retCode = osMessageQueuePut(
|
||||||
queue_lcd_id,
|
queue_lcd_id,
|
||||||
&queueMsg,
|
&queueMsg,
|
||||||
@ -81,6 +81,9 @@ void MacSender(void *argument) {
|
|||||||
osWaitForever);
|
osWaitForever);
|
||||||
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
||||||
|
|
||||||
|
retCode = osMemoryPoolFree(memPool, queueMsg.anyPtr);
|
||||||
|
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
||||||
|
|
||||||
// Send one msg from internal queue if exist
|
// Send one msg from internal queue if exist
|
||||||
//if (osMemoryPoolGetCount(queue_macData_id) != 0) { // Message in Queue
|
//if (osMemoryPoolGetCount(queue_macData_id) != 0) { // Message in Queue
|
||||||
retCode = osMessageQueueGet(queue_macData_id, &queueMsg, NULL, 0);
|
retCode = osMessageQueueGet(queue_macData_id, &queueMsg, NULL, 0);
|
||||||
@ -94,8 +97,6 @@ void MacSender(void *argument) {
|
|||||||
0);
|
0);
|
||||||
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
||||||
} else {
|
} else {
|
||||||
retCode = osMemoryPoolFree(memPool, queueMsg.anyPtr);
|
|
||||||
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
|
|
||||||
sendToken();
|
sendToken();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -244,20 +245,18 @@ void MacSender(void *argument) {
|
|||||||
src.nothing = 0;
|
src.nothing = 0;
|
||||||
length = strlen(queueMsg.anyPtr);
|
length = strlen(queueMsg.anyPtr);
|
||||||
|
|
||||||
if(dst.addr != BROADCAST_ADDRESS) {
|
|
||||||
stationStatus.raw = gTokenInterface.station_list[dst.addr];
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (stationStatus.chat == 1) || (dst.addr == BROADCAST_ADDRESS)) {
|
|
||||||
|
|
||||||
if(dst.addr == BROADCAST_ADDRESS) {
|
if(dst.addr == BROADCAST_ADDRESS) {
|
||||||
status.read = 1;
|
status.read = 1;
|
||||||
status.ack = 1;
|
status.ack = 1;
|
||||||
|
stationStatus.raw = 0;
|
||||||
} else {
|
} else {
|
||||||
status.read = 0;
|
status.read = 0;
|
||||||
status.ack = 0;
|
status.ack = 0;
|
||||||
|
stationStatus.raw = gTokenInterface.station_list[dst.addr];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( (dst.addr == BROADCAST_ADDRESS) || (stationStatus.chat == 1)) {
|
||||||
|
|
||||||
msg = osMemoryPoolAlloc(memPool, 0);
|
msg = osMemoryPoolAlloc(memPool, 0);
|
||||||
if(msg == NULL) {
|
if(msg == NULL) {
|
||||||
printf("Memory allocation failed #1\r\n");
|
printf("Memory allocation failed #1\r\n");
|
||||||
@ -281,7 +280,6 @@ void MacSender(void *argument) {
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
memcpy(lastSentMsgPtr, msg, length+4);
|
memcpy(lastSentMsgPtr, msg, length+4);
|
||||||
// TODO test if station is online
|
|
||||||
}
|
}
|
||||||
|
|
||||||
queueMsg.anyPtr = msg;
|
queueMsg.anyPtr = msg;
|
||||||
|
@ -157,9 +157,41 @@
|
|||||||
<Bp>
|
<Bp>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Type>0</Type>
|
<Type>0</Type>
|
||||||
<LineNumber>18</LineNumber>
|
<LineNumber>108</LineNumber>
|
||||||
<EnabledFlag>1</EnabledFlag>
|
<EnabledFlag>1</EnabledFlag>
|
||||||
<Address>134312290</Address>
|
<Address>134255386</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\tokenring_project\mac_sender.c\108</Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>1</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>110</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134255394</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\tokenring_project\mac_sender.c\110</Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>2</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>116</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134254758</Address>
|
||||||
<ByteObject>0</ByteObject>
|
<ByteObject>0</ByteObject>
|
||||||
<HtxType>0</HtxType>
|
<HtxType>0</HtxType>
|
||||||
<ManyObjects>0</ManyObjects>
|
<ManyObjects>0</ManyObjects>
|
||||||
@ -168,45 +200,77 @@
|
|||||||
<BreakIfRCount>1</BreakIfRCount>
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
<Filename>.\mac_receiver.c</Filename>
|
<Filename>.\mac_receiver.c</Filename>
|
||||||
<ExecCommand></ExecCommand>
|
<ExecCommand></ExecCommand>
|
||||||
<Expression>\\tokenring_project\mac_receiver.c\18</Expression>
|
<Expression>\\tokenring_project\mac_receiver.c\116</Expression>
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>1</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>106</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>.\mac_sender.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
|
||||||
<Bp>
|
|
||||||
<Number>2</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>107</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>0</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>0</BreakIfRCount>
|
|
||||||
<Filename>.\mac_sender.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression></Expression>
|
|
||||||
</Bp>
|
</Bp>
|
||||||
<Bp>
|
<Bp>
|
||||||
<Number>3</Number>
|
<Number>3</Number>
|
||||||
<Type>0</Type>
|
<Type>0</Type>
|
||||||
<LineNumber>199</LineNumber>
|
<LineNumber>89</LineNumber>
|
||||||
<EnabledFlag>1</EnabledFlag>
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>134255344</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>1</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression>\\tokenring_project\mac_sender.c\89</Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>4</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>92</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>5</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>109</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>6</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>111</LineNumber>
|
||||||
|
<EnabledFlag>1</EnabledFlag>
|
||||||
|
<Address>0</Address>
|
||||||
|
<ByteObject>0</ByteObject>
|
||||||
|
<HtxType>0</HtxType>
|
||||||
|
<ManyObjects>0</ManyObjects>
|
||||||
|
<SizeOfObject>0</SizeOfObject>
|
||||||
|
<BreakByAccess>0</BreakByAccess>
|
||||||
|
<BreakIfRCount>0</BreakIfRCount>
|
||||||
|
<Filename>.\mac_sender.c</Filename>
|
||||||
|
<ExecCommand></ExecCommand>
|
||||||
|
<Expression></Expression>
|
||||||
|
</Bp>
|
||||||
|
<Bp>
|
||||||
|
<Number>7</Number>
|
||||||
|
<Type>0</Type>
|
||||||
|
<LineNumber>199</LineNumber>
|
||||||
|
<EnabledFlag>0</EnabledFlag>
|
||||||
<Address>0</Address>
|
<Address>0</Address>
|
||||||
<ByteObject>0</ByteObject>
|
<ByteObject>0</ByteObject>
|
||||||
<HtxType>0</HtxType>
|
<HtxType>0</HtxType>
|
||||||
@ -223,32 +287,37 @@
|
|||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>sai</ItemText>
|
<ItemText>gTokenInterface</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>1</count>
|
<count>1</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>gTokenInterface</ItemText>
|
<ItemText>t</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>2</count>
|
<count>2</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>t</ItemText>
|
<ItemText>lastToken,0x10</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>3</count>
|
<count>3</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>lastToken</ItemText>
|
<ItemText>memPool</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>4</count>
|
<count>4</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>memPool</ItemText>
|
<ItemText>qPtr[0]</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>5</count>
|
<count>5</count>
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>qPtr</ItemText>
|
<ItemText>qPtr[1]</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>6</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>qPtr[2]</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<MemoryWindow1>
|
<MemoryWindow1>
|
||||||
@ -558,7 +627,7 @@
|
|||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>::CMSIS</GroupName>
|
<GroupName>::CMSIS</GroupName>
|
||||||
<tvExp>1</tvExp>
|
<tvExp>0</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>1</RteFlg>
|
<RteFlg>1</RteFlg>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<TargetName>Target 1</TargetName>
|
<TargetName>Target 1</TargetName>
|
||||||
<ToolsetNumber>0x4</ToolsetNumber>
|
<ToolsetNumber>0x4</ToolsetNumber>
|
||||||
<ToolsetName>ARM-ADS</ToolsetName>
|
<ToolsetName>ARM-ADS</ToolsetName>
|
||||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::..\..\Program Files (x86)\ARM_Compiler_5.06u7</pCCUsed>
|
<pCCUsed>5060960::V5.06 update 7 (build 960)::C:\Program Files (x86)\ARM_Compiler_5.06u7</pCCUsed>
|
||||||
<uAC6>0</uAC6>
|
<uAC6>0</uAC6>
|
||||||
<TargetOption>
|
<TargetOption>
|
||||||
<TargetCommonOption>
|
<TargetCommonOption>
|
||||||
|
Reference in New Issue
Block a user