projects
/
ostree.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0ea7d2e
)
tree: Fix `name` memory leak
author
Luke Yang
<luke.jia.yang@gmail.com>
Wed, 12 Jun 2024 19:50:54 +0000
(15:50 -0400)
committer
Luke Yang
<luke.jia.yang@gmail.com>
Thu, 20 Jun 2024 19:09:11 +0000
(15:09 -0400)
Coverity points out that we have a memory leak from `g_strdup(name)`.
`insert_child_mtree()` takes a const char * and duplicates it.
`name` can be passed directly to `insert_child_mtree()`.
src/libostree/ostree-mutable-tree.c
patch
|
blob
|
history
diff --git
a/src/libostree/ostree-mutable-tree.c
b/src/libostree/ostree-mutable-tree.c
index 3a47de61aefbb7d49ee4bd6db762a5d90d1902ea..29f72a90fbafd17db9ba1af6a4b99c528848fed6 100644
(file)
--- a/
src/libostree/ostree-mutable-tree.c
+++ b/
src/libostree/ostree-mutable-tree.c
@@
-452,7
+452,7
@@
ostree_mutable_tree_ensure_parent_dirs (OstreeMutableTree *self, GPtrArray *spli
invalidate_contents_checksum (subdir);
next = ostree_mutable_tree_new ();
ostree_mutable_tree_set_metadata_checksum (next, metadata_checksum);
- insert_child_mtree (subdir,
g_strdup (name)
, next);
+ insert_child_mtree (subdir,
name
, next);
}
subdir = next;