patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Sorry to nitpick but in vcache.h (cpp branch) a new char[] is done but
a delete - no delete []. And first it does a strlen() and after that a
strcpy - which could've been a memcpy because you already know the
length.

Index: vcache.h
===================================================================
--- vcache.h	(revision 880)
+++ vcache.h	(working copy)
@@ -104,9 +104,9 @@
 public:
 	vholder(const char * nm, T val)
 	{
-		int i = (int) strlen(nm);
-		name = new char[i+1];
-		strcpy(name, nm);
+		size_t i = strlen(nm) + 1;
+		name = new char[i];
+		memcpy(name, nm, i);
 		obj = val;
 		next = NULL;
 	}
@@ -113,7 +113,7 @@
 
 	~vholder()
 	{
-		delete name;
+		delete [] name;
 	}
 };


Folkert van Heusden

www.vanheusden.com

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
open-cobol-list mailing list
open-cobol-list@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/open-cobol-list



[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux