Skip to content

Commit

Permalink
sysroot: Make devpath more clear
Browse files Browse the repository at this point in the history
Coverity points out that we have a memory leak from g_strdup(devpath).
This is a mistake from coverity. However, we use `g_path_get_dirname()`
which makes the process clearer since it does not modify the string in
place.
  • Loading branch information
lukewarmtemp committed Jun 13, 2024
1 parent 6390f11 commit 1e472e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libostree/ostree-sysroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2243,7 +2243,7 @@ ostree_sysroot_deployment_unlock (OstreeSysroot *self, OstreeDeployment *deploym
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT)
: _ostree_sysroot_get_runstate_path (
deployment, _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_TRANSIENT);
g_autofree char *devpath_parent = dirname (g_strdup (devpath));
g_autofree char *devpath_parent = g_path_get_dirname (g_strdup (devpath));

if (!glnx_shutil_mkdir_p_at (AT_FDCWD, devpath_parent, 0755, cancellable, error))
return FALSE;
Expand Down

0 comments on commit 1e472e0

Please sign in to comment.