[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] patch
From: |
folkert |
Subject: |
[open-cobol-list] patch |
Date: |
Fri, 13 May 2016 22:26:57 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] patch,
folkert <=