diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-30 17:33:20 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-30 17:33:20 +0300 |
| commit | b525fbcad1ac8c7126caa82ec8458ffbb6284384 (patch) | |
| tree | 61abe4c1610fc2e0b6af8e5f926d5624692df2fe /Software/Embedded_SW/Embedded/StateMachines | |
| parent | 405096b3d489f4ea7b50b1d5db7d32241251b8d7 (diff) | |
| download | Tango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.tar.gz Tango-b525fbcad1ac8c7126caa82ec8458ffbb6284384.zip | |
Version 1.4.0.4: Improved memory handling, handles SW crash after a job failure
Diffstat (limited to 'Software/Embedded_SW/Embedded/StateMachines')
| -rw-r--r-- | Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c | 3 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c | 18 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c index f5ae89368..44dd09030 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/JobSTM.c @@ -860,7 +860,8 @@ void AbortJob(char *Msg) Message.messageId = Abort; PrtMessage->messageId = PrintSystemFailure; - strcpy(PrtMessage->messageData,Msg); + strncpy(PrtMessage->messageData,Msg,99); + //PrtMessage->messageData[99] = NULL; Message.msglen = 10; if (JobmsgQ != NULL) Mailbox_post(JobmsgQ , &Message, BIOS_NO_WAIT); diff --git a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c index 2aa260e9f..484dc9e7e 100644 --- a/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c +++ b/Software/Embedded_SW/Embedded/StateMachines/Printing/PrintingSTM.c @@ -122,9 +122,15 @@ FRESULT CloseJobFile() my_free (JobRequestFileHandle); JobRequestFileHandle = NULL; if (BrushStopPtr) + { my_free(BrushStopPtr); + BrushStopPtr = NULL; + } if (SegmentPtr) + { my_free(SegmentPtr); + SegmentPtr = NULL; + } REPORT_MSG(Fresult,"CloseJobFile"); return Fresult; @@ -145,7 +151,10 @@ JobDescriptionFileSegment *GetNextSegmentFromJobFile() { readbBytes += ImmediateRead; if (SegmentPtr) + { my_free(SegmentPtr); + SegmentPtr = NULL; + } SegmentPtr = my_malloc (SegmentSize); if (SegmentPtr) { @@ -158,6 +167,7 @@ JobDescriptionFileSegment *GetNextSegmentFromJobFile() } }// read segment data my_free(SegmentPtr); + SegmentPtr = NULL; }//segment malloc else { @@ -181,6 +191,7 @@ void FreeSegmentFileData(JobDescriptionFileSegment *Segment) Segment = NULL; if (SegmentPtr) my_free(SegmentPtr); + SegmentPtr = NULL; } JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() { @@ -196,7 +207,10 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() { readbBytes += ImmediateRead; if (BrushStopPtr) + { my_free(BrushStopPtr); + BrushStopPtr = NULL; + } BrushStopPtr = my_malloc (BrushStopSize); if (BrushStopPtr) @@ -213,6 +227,7 @@ JobDescriptionFileBrushStop *GetNextBrushStopFromJobFile() //status = ERROR; } my_free(BrushStopPtr); + BrushStopPtr = NULL; }//brushstop size read ok else { @@ -237,6 +252,7 @@ void FreeBrushStopFileData(JobDescriptionFileBrushStop *BrushStop) BrushStop = NULL; if (BrushStopPtr) my_free(BrushStopPtr); + BrushStopPtr = NULL; } /************************************************************************************************************************************/ /* this function is for development initial stages. it analyses the hardware configuration to determine which modules are operational @@ -546,7 +562,7 @@ uint32_t EndState(void *JobDetails, char *Message) { //ROM_IntMasterDisable(); //SuspendLargeMessages = true; - LOG_ERROR(2,"SuspendLargeMessages EndState"); + //LOG_ERROR(2,"SuspendLargeMessages EndState"); //DiagnosticsStop(); if (Configured[Module_Winder]) { |
