Comments (2)
I don't see ... that it would require the caller to make a copy
I think we're OK. The jobs of the dialogs is to select a key, but as you've spotted they return differently.
By contrast, in
dlg_gpgme()
, the user selection causes the key to be copied:neomutt/ncrypt/gpgme_functions.c
Lines 728 to 785 in 07e12e7
Ahh, this is what I was looking for but didn't find.
Both methods work and I don't think either leaks. My preference of the two styles is for
dlg_smime()
-- the dialog selects a key from a list, but nothing else.
Agree.
from neomutt.
SMIME code, probably a couple of memory leaks:
Entirely possible, the code's seldom been looked at.
I don't see ... that it would require the caller to make a copy
I think we're OK.
The jobs of the dialogs is to select a key, but as you've spotted they return differently.
In smime_get_key_by_addr()
, we get all the possible keys:
Line 616 in 07e12e7
and filter it down into matches
, then have one of several paths:
Lines 647 to 670 in 07e12e7
In the Dialog path, the user selects a key -- this is one of the keys in matches
:
neomutt/ncrypt/smime_functions.c
Lines 53 to 88 in 07e12e7
which is returned:
Line 262 in 07e12e7
All the paths in smime_get_key_by_addr()
now call return_key = smime_copy_key()
on the selection and then free matches
:
Line 669 in 07e12e7
Finally, smime_get_key_by_addr()
returns the single selected key:
Line 672 in 07e12e7
smime_get_key_by_str() follows the same pattern, but more simply.
It is almost identical to
dlg_gpgme()
, which doesn't require it.
By contrast, in dlg_gpgme()
, the user selection causes the key to be copied:
neomutt/ncrypt/gpgme_functions.c
Lines 728 to 785 in 07e12e7
then crypt_getkeybyaddr()
keeps track of the copied key, frees matches
and returns the selected key:
Lines 3256 to 3266 in 07e12e7
crypt_getkeybystr()
works the same way.
Both methods work and I don't think either leaks.
My preference of the two styles is for dlg_smime()
-- the dialog selects a key from a list, but nothing else.
Looking through the code, there's room for improvement.
We could use TAILQ
or ARRAY
, rather than a homegrown List
implementation,
but those upgrades might require a lot of changes.
from neomutt.
Related Issues (20)
- Do we need to handle <stddef.h> specially? HOT 1
- conditional format strings broken in 2024-04-25 HOT 8
- Duplicate gpg keys in key selection menu for message encryption HOT 18
- segfault while opening a mailbox in from the sidebar HOT 2
- Doubts about paranoic defensive programming style HOT 3
- C dialect HOT 2
- tag-prefix doesn't show-up in attach HOT 5
- Doubts about some `*const` pointers HOT 5
- How to use the notmuch command <modify-labels> to tag emails with tags containing spaces?
- Is it possible to edit the automatic title when forwarding or replying a message? HOT 1
- Progress for postponing a message with remote (IMAP)
- autocrypt breaks command line argument `-e "push foo"` HOT 2
- How to forward an email thread to someone else together with attachments ? HOT 3
- `delete-thread` does not support `tag-prefix` operator
- split outgoing email into batches to work around max number of recipients limit in some SMTP providers (infomaniak) HOT 3
- save-message from GMail over IMAP to local box doesn't delete original HOT 3
- Cannot open an .mbox file with neomutt (although it works with mutt) HOT 1
- neomutt truecolor and kitty
- neomutt does not replace `...` by encrypted subject
- Inline-PGP with junk before recognized incorrectly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neomutt.