mirror of
https://github.com/linux-can/can-utils.git
synced 2026-11-04 15:31:10 +01:00
isobusfs: srv: free handle path when closing the handle
The path of an opened file or directory handle is allocated with strdup() but was not freed when the handle got closed. Every open/close sequence leaked the path string. Free the path before clearing the handle. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
@@ -159,6 +159,7 @@ static int isobusfs_srv_release_handle(struct isobusfs_srv_priv *priv,
|
|||||||
closedir(hdl->dir);
|
closedir(hdl->dir);
|
||||||
else
|
else
|
||||||
close(hdl->fd);
|
close(hdl->fd);
|
||||||
|
free(hdl->path);
|
||||||
memset(hdl, 0, sizeof(*hdl));
|
memset(hdl, 0, sizeof(*hdl));
|
||||||
priv->handles_count--;
|
priv->handles_count--;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user