@@ -244,6 +244,7 @@ void FPS_GT511C3::Open()
244
244
cp->Parameter [2 ] = 0x00 ;
245
245
cp->Parameter [3 ] = 0x00 ;
246
246
byte* packetbytes = cp->GetPacketBytes ();
247
+ delete cp;
247
248
SendCommand (packetbytes, 12 );
248
249
Response_Packet* rp = GetResponse ();
249
250
delete rp;
@@ -262,6 +263,7 @@ void FPS_GT511C3::Close()
262
263
cp->Parameter [2 ] = 0x00 ;
263
264
cp->Parameter [3 ] = 0x00 ;
264
265
byte* packetbytes = cp->GetPacketBytes ();
266
+ delete cp;
265
267
SendCommand (packetbytes, 12 );
266
268
Response_Packet* rp = GetResponse ();
267
269
delete rp;
@@ -289,13 +291,13 @@ bool FPS_GT511C3::SetLED(bool on)
289
291
cp->Parameter [2 ] = 0x00 ;
290
292
cp->Parameter [3 ] = 0x00 ;
291
293
byte* packetbytes = cp->GetPacketBytes ();
294
+ delete cp;
292
295
SendCommand (packetbytes, 12 );
293
296
Response_Packet* rp = GetResponse ();
294
297
bool retval = true ;
295
298
if (rp->ACK == false ) retval = false ;
296
299
delete rp;
297
300
delete packetbytes;
298
- delete cp;
299
301
return retval;
300
302
};
301
303
@@ -313,6 +315,7 @@ bool FPS_GT511C3::ChangeBaudRate(int baud)
313
315
cp->Command = Command_Packet::Commands::Open;
314
316
cp->ParameterFromInt (baud);
315
317
byte* packetbytes = cp->GetPacketBytes ();
318
+ delete cp;
316
319
SendCommand (packetbytes, 12 );
317
320
Response_Packet* rp = GetResponse ();
318
321
bool retval = rp->ACK ;
@@ -340,6 +343,7 @@ int FPS_GT511C3::GetEnrollCount()
340
343
cp->Parameter [2 ] = 0x00 ;
341
344
cp->Parameter [3 ] = 0x00 ;
342
345
byte* packetbytes = cp->GetPacketBytes ();
346
+ delete cp;
343
347
SendCommand (packetbytes, 12 );
344
348
Response_Packet* rp = GetResponse ();
345
349
@@ -488,6 +492,7 @@ bool FPS_GT511C3::IsPressFinger()
488
492
Command_Packet* cp = new Command_Packet ();
489
493
cp->Command = Command_Packet::Commands::IsPressFinger;
490
494
byte* packetbytes = cp->GetPacketBytes ();
495
+ delete cp;
491
496
SendCommand (packetbytes, 12 );
492
497
Response_Packet* rp = GetResponse ();
493
498
bool retval = false ;
@@ -498,7 +503,6 @@ bool FPS_GT511C3::IsPressFinger()
498
503
if (pval == 0 ) retval = true ;
499
504
delete rp;
500
505
delete packetbytes;
501
- delete cp;
502
506
return retval;
503
507
}
504
508
@@ -512,12 +516,12 @@ bool FPS_GT511C3::DeleteID(int id)
512
516
cp->Command = Command_Packet::Commands::DeleteID;
513
517
cp->ParameterFromInt (id);
514
518
byte* packetbytes = cp->GetPacketBytes ();
519
+ delete cp;
515
520
SendCommand (packetbytes, 12 );
516
521
Response_Packet* rp = GetResponse ();
517
522
bool retval = rp->ACK ;
518
523
delete rp;
519
524
delete packetbytes;
520
- delete cp;
521
525
return retval;
522
526
}
523
527
@@ -552,6 +556,7 @@ int FPS_GT511C3::Verify1_1(int id)
552
556
cp->Command = Command_Packet::Commands::Verify1_1;
553
557
cp->ParameterFromInt (id);
554
558
byte* packetbytes = cp->GetPacketBytes ();
559
+ delete cp;
555
560
SendCommand (packetbytes, 12 );
556
561
Response_Packet* rp = GetResponse ();
557
562
int retval = 0 ;
@@ -564,7 +569,6 @@ int FPS_GT511C3::Verify1_1(int id)
564
569
}
565
570
delete rp;
566
571
delete packetbytes;
567
- delete cp;
568
572
return retval;
569
573
}
570
574
@@ -578,13 +582,13 @@ int FPS_GT511C3::Identify1_N()
578
582
Command_Packet* cp = new Command_Packet ();
579
583
cp->Command = Command_Packet::Commands::Identify1_N;
580
584
byte* packetbytes = cp->GetPacketBytes ();
585
+ delete cp;
581
586
SendCommand (packetbytes, 12 );
582
587
Response_Packet* rp = GetResponse ();
583
588
int retval = rp->IntFromParameter ();
584
589
if (retval > 200 ) retval = 200 ;
585
590
delete rp;
586
591
delete packetbytes;
587
- delete cp;
588
592
return retval;
589
593
}
590
594
@@ -606,12 +610,12 @@ bool FPS_GT511C3::CaptureFinger(bool highquality)
606
610
cp->ParameterFromInt (0 );
607
611
}
608
612
byte* packetbytes = cp->GetPacketBytes ();
613
+ delete cp;
609
614
SendCommand (packetbytes, 12 );
610
615
Response_Packet* rp = GetResponse ();
611
616
bool retval = rp->ACK ;
612
617
delete rp;
613
618
delete packetbytes;
614
- delete cp;
615
619
return retval;
616
620
617
621
}
@@ -761,8 +765,8 @@ void FPS_GT511C3::SendToSerial(byte data[], int length)
761
765
Serial.print (" \" " );
762
766
for (int i=0 ; i<length; i++)
763
767
{
764
- if (first) first=false ; else Serial.print (" " );
765
- serialPrintHex (data[i]);
768
+ if (first) first=false ; else Serial.print (" " );
769
+ serialPrintHex (data[i]);
766
770
}
767
771
Serial.print (" \" " );
768
772
}
0 commit comments