Fix: Memory leaks#575
Open
Piloalucard wants to merge 10 commits intoLinearTapeFileSystem:v2.4.8-windows-supportfrom
Open
Fix: Memory leaks#575Piloalucard wants to merge 10 commits intoLinearTapeFileSystem:v2.4.8-windows-supportfrom
Piloalucard wants to merge 10 commits intoLinearTapeFileSystem:v2.4.8-windows-supportfrom
Conversation
amissael95
requested changes
Mar 6, 2026
Added comment to clarify data pointer adjustment for writing.
Added comments to clarify memory allocation and buffer usage.
amissael95
approved these changes
Mar 11, 2026
Contributor
amissael95
left a comment
There was a problem hiding this comment.
Thanks for working in this important change and addressing my comments. Approved!
syaoraang
requested changes
Mar 11, 2026
Collaborator
syaoraang
left a comment
There was a problem hiding this comment.
Overall it looks pretty good, just a few comments.
src/libltfs/arch/ltfs_arch_ops.h
Outdated
| #define arch_vsprintf_auto( buffer, fmt, ...) arch_vsprintf(buffer,sizeof(buffer),fmt,__VA_ARGS__) | ||
|
|
||
| /* | ||
| These needs to be declared at the end to avoid redefinition and to avoid code replication |
Collaborator
There was a problem hiding this comment.
"This needs..." instead of "These needs...", according to the context
src/libltfs/ltfs_fsops.c
Outdated
Comment on lines
+2072
to
+2073
| if(token) | ||
| arch_strncpy(work_buf+len+1, token, work_buf_len, strlen(token)); /* "/aaa/ccc/target.txt\0" */ |
Collaborator
There was a problem hiding this comment.
Please, use braces even on single-line ifs.
src/libltfs/tape.c
Outdated
| if (attr_data == NULL) return -LTFS_NO_MEMORY; | ||
| int attr_size = sizeof(char) * (attr_len + TC_MAM_PAGE_HEADER_SIZE); | ||
| attr_data = (unsigned char*)malloc(attr_size); | ||
| if (!attr_data) return -LTFS_NO_MEMORY; |
Collaborator
There was a problem hiding this comment.
Please use braces and line jumps for better readability.
src/libltfs/xml_reader_libltfs.c
Outdated
| { | ||
| const char name[] = "nametype", *value; | ||
| char *decoded_name, *encoded_name, *encode; | ||
| char* decoded_name = NULL, * encoded_name = NULL, * encode = NULL; |
Collaborator
There was a problem hiding this comment.
To have consistency, could you please use "char " instead of "char ", just a few lines below we are using "char *" , besides, it's most widely used across the code base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
This pull request includes following changes or fixes.
Type of change
Please delete items that are not relevant.
Checklist: