[PATCH libSM] Fix some potential memory leaks in SmcCloseConnection().
Kim Woelders
kim at woelders.dk
Mon May 2 17:57:45 UTC 2022
Hello again, a decade later :) ,
I rediscovered this patch, which still fixes some memory leaks and still
applies to current git.
I have attached the mentioned test program and the amended patch, which
it seems i forgot to include the last time around.
/Kim
On 11/27/10 16:00, Kim Woelders wrote:
> On Sat, 27 Nov 2010 05:10:15 +0100, Corbin Simpson
> <mostawesomedude at gmail.com> wrote:
>
>> On Fri, Nov 26, 2010 at 4:34 PM, Jesse Adkins
>> <jesserayadkins at gmail.com> wrote:
>>> I had to backspace after the 'char' and before '**reasonMsgs' to get
>>> this to apply. Perhaps the git repo has been updated since this patch.
>>> Aside from that, it applies.
>>>
> Some mailer issue? The source file hasn't been changed since Jan 2009.
> I have no problems git am'ing my e-mail.
>
>>> Can you comment on why this is needed, either in the code or in the
>>> git commit? Is there anything that can be done to trigger this leak? I
>>> have no problem with giving this a test, but I've never heard of a
>>> leak in libSM when running X in valgrind mode or using it on clients.
>>>
> I have attached a completely foolish program that triggers both memory
> leaks, and I'm quite certain that they can be triggered in less
> pathological situations.
>
>>
>> Is it proper convention to cast arguments to free() as char* in this
>> lib? I'd rather just leave it uncasted.
>>
> So would I, but I considered it more important to maintain the existing
> style.
> If "new" style is considered more important I'll send a new patch.
>
>> Shutting up Valgrind is always important, even if the leak in question
>> is trivial.
>>
>> Reviewed-by: Corbin Simpson <MostAwesomeDude at gmail.com>
>>
> Thanks, added to patch.
>
> /Kim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sm.c
Type: text/x-csrc
Size: 732 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20220502/fe37505e/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-some-potential-memory-leaks-in-SmcCloseConnectio.patch
Type: text/x-patch
Size: 992 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20220502/fe37505e/attachment.bin>
More information about the xorg-devel
mailing list