[apparmor] [PATCH] parser: Fix delete after new[]
Seth Arnold
seth.arnold at canonical.com
Tue Mar 21 19:06:38 UTC 2017
On Tue, Mar 21, 2017 at 07:06:45PM +0300, Oleg Strikov wrote:
> Fix for the issue found by address sanitizer.
Looks good to me, thanks for the contribution.
Acked-by: Seth Arnold <seth.arnold at canonical.com>
> === modified file 'parser/libapparmor_re/expr-tree.h'
> --- parser/libapparmor_re/expr-tree.h 2016-01-19 23:07:04 +0000
> +++ parser/libapparmor_re/expr-tree.h 2017-03-21 15:33:53 +0000
> @@ -663,25 +663,25 @@
> hashedNodeVec(NodeSet *n, unsigned long h): hash(h)
> {
> len = n->size();
> nodes = new ImportantNode *[n->size()];
> ImportantNode **j = nodes;
> for (NodeSet::iterator i = n->begin(); i != n->end(); i++) {
> *(j++) = *i;
> }
> }
>
> ~hashedNodeVec()
> {
> - delete nodes;
> + delete [] nodes;
> }
>
> unsigned long size()const { return len; }
>
> bool operator<(hashedNodeVec const &rhs)const
> {
> if (hash == rhs.hash) {
> if (len == rhs.size()) {
> for (unsigned int i = 0; i < len; i++) {
> if (nodes[i] != rhs.nodes[i])
> return nodes[i] < rhs.nodes[i];
> }
>
> Thanks,
> Oleg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20170321/ae61bbc2/attachment.pgp>
More information about the AppArmor
mailing list