mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-07 01:13:18 +00:00
Fix memory leaks from refactor
This commit is contained in:
+13
-6
@@ -117,7 +117,7 @@ int main() {
|
|||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
if (!BUS_IS_IDLE) {
|
if (!BUS_IS_IDLE) {
|
||||||
msg = (AVCLAN_frame_t *)(&cache);
|
msg = (AVCLAN_frame_t *)popQueue(&cache);
|
||||||
if (!msg) {
|
if (!msg) {
|
||||||
RS232_Print("!! Dropping an incoming message; cache is empty !!");
|
RS232_Print("!! Dropping an incoming message; cache is empty !!");
|
||||||
continue;
|
continue;
|
||||||
@@ -126,6 +126,8 @@ int main() {
|
|||||||
err = AVCLAN_readframe(msg);
|
err = AVCLAN_readframe(msg);
|
||||||
if (!err)
|
if (!err)
|
||||||
err = pushQueue(&incoming, msg) && pushQueue(&cache, msg);
|
err = pushQueue(&incoming, msg) && pushQueue(&cache, msg);
|
||||||
|
else
|
||||||
|
pushQueue(&cache, msg);
|
||||||
} else if (!isEmpty(&incoming)) {
|
} else if (!isEmpty(&incoming)) {
|
||||||
out = (AVCLAN_frame_t *)popQueue(&cache);
|
out = (AVCLAN_frame_t *)popQueue(&cache);
|
||||||
if (!out) {
|
if (!out) {
|
||||||
@@ -232,7 +234,8 @@ int main() {
|
|||||||
}
|
}
|
||||||
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
||||||
push_or_return_resp(resp);
|
push_or_return_resp(resp);
|
||||||
}
|
} else
|
||||||
|
pushQueue(&cache, out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
@@ -251,7 +254,8 @@ int main() {
|
|||||||
}
|
}
|
||||||
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
||||||
push_or_return_resp(resp);
|
push_or_return_resp(resp);
|
||||||
}
|
} else
|
||||||
|
pushQueue(&cache, out);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -297,8 +301,10 @@ int main() {
|
|||||||
if (resp) {
|
if (resp) {
|
||||||
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
||||||
push_or_return_resp(resp);
|
push_or_return_resp(resp);
|
||||||
}
|
} else
|
||||||
}
|
pushQueue(&cache, out);
|
||||||
|
} else
|
||||||
|
pushQueue(&cache, out);
|
||||||
}
|
}
|
||||||
readSeq = readBinary = 0;
|
readSeq = readBinary = 0;
|
||||||
} else
|
} else
|
||||||
@@ -319,7 +325,8 @@ int main() {
|
|||||||
memcpy(out->data, data_tmp, seqLen);
|
memcpy(out->data, data_tmp, seqLen);
|
||||||
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
*resp = (RFrame_t){.r = r_Handled, .frame = out};
|
||||||
push_or_return_resp(resp);
|
push_or_return_resp(resp);
|
||||||
}
|
} else
|
||||||
|
pushQueue(&cache, out);
|
||||||
}
|
}
|
||||||
printAllFrames = lastPrintAllFrames;
|
printAllFrames = lastPrintAllFrames;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user