Conversation
|
Thanks for submitting a PR! Maybe @larsewi can review this? |
larsewi
requested changes
Sep 22, 2026
| if (files == NULL) | ||
| { | ||
| Log(LOG_LEVEL_ERR, "Could not open %s", state); | ||
| files = SeqNew(1, NULL); |
Contributor
There was a problem hiding this comment.
Suggested change
| files = SeqNew(1, NULL); | |
| return NULL; |
Contributor
Author
There was a problem hiding this comment.
Ah, didn't check for other uses of argv_to_lmdb_files(). Will squash if updated change is ok. I guess, leaking sequence is no real issue on argv_to_lmdb_files() usage?
% valgrind --leak-check=full ./cf-check/cf-check dump
==1477289== Memcheck, a memory error detector
==1477289== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==1477289== Using Valgrind-3.24.0 and LibVEX; rerun with -h for copyright info
==1477289== Command: ./cf-check/cf-check dump
==1477289==
info: No filenames specified, defaulting to .lmdb files in /home/btriller/.cfagent/state
No database files to dump.
==1477289==
==1477289== HEAP SUMMARY:
==1477289== in use at exit: 136 bytes in 3 blocks
==1477289== total heap usage: 34 allocs, 31 frees, 53,996 bytes allocated
==1477289==
==1477289== 112 (32 direct, 80 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==1477289== at 0x4844818: malloc (vg_replace_malloc.c:446)
==1477289== by 0x11209C: xmalloc (alloc.c:42)
==1477289== by 0x11BBA7: SeqNew (sequence.c:32)
==1477289== by 0x112AE3: ListDir (file_lib.c:634)
==1477289== by 0x10F750: default_lmdb_files (utilities.c:14)
==1477289== by 0x10F4C7: dump_main (dump.c:556)
==1477289== by 0x10CD49: main (cf-check.c:209)
==1477289==
==1477289== LEAK SUMMARY:
==1477289== definitely lost: 32 bytes in 1 blocks
==1477289== indirectly lost: 80 bytes in 1 blocks
==1477289== possibly lost: 0 bytes in 0 blocks
==1477289== still reachable: 24 bytes in 1 blocks
==1477289== suppressed: 0 bytes in 0 blocks
==1477289== Reachable blocks (those to which a pointer was found) are not shown.
==1477289== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1477289==
==1477289== For lists of detected and suppressed errors, rerun with: -s
==1477289== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
larsewi
reviewed
Sep 22, 2026
larsewi
left a comment
Contributor
There was a problem hiding this comment.
This is good. However, I still think argv_to_lmdb_files should return NULL on failure, so that the call sites can handle it.
The memory leak is preexisting. But, feel free to fix it too, preferably in a separate commit.
Thanks again!
Comment on lines
+559
to
+563
| if (files == NULL || SeqLength(files) == 0) | ||
| { | ||
| printf("No database files to dump.\n"); | ||
| return 1; | ||
| } |
Contributor
There was a problem hiding this comment.
The argv_to_lmdb_files already logs an error. Hence, there is no need to log another one here.
Suggested change
| if (files == NULL || SeqLength(files) == 0) | |
| { | |
| printf("No database files to dump.\n"); | |
| return 1; | |
| } | |
| if (files == NULL || SeqLength(files) == 0) | |
| { | |
| return 1; | |
| } |
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.
No description provided.