🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14274

Re: SHGetSpecialFolderLocation!

#14274
From: Remy Lebeau (TeamB)
Date: Tue, 19 Aug 2003 23:40
27 lines
1819 bytes
"Rodolfo Frino" <rodolfofrino@yahoo.com> wrote in message
news:3f42a46c@newsgroups.borland.com...

> Get rid of CoTaskMemFree function since you did
> not allocate with neither CoTaskMemAlloc nor
> CoTaskMemRealloc functions.

Do not get rid of it!  Your code did not allocate the ITEMIDLIST, but
SHGetSpecialFolderLocation() did.  Because the memory was returned to your
code, it is your code's responsibility to free the memory.  Otherwise it is
leaked.

>      if (!SHGetSpecialFolderLocation(0, Folder, &List))
>         if (SHGetPathFromIDList(List, Path))
>            return String(Path);

The ITEMIDLIST is being leaked in that code.


Gambit


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 8/14/03
Technical Details
Message-ID: <3f42b3c1$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3F425543.9040507@alloymail.com> <3f42a46c@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7ce38efab0f8f813
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-19 16:38:33 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3F425543.9040507@alloymail.com> <3f42a46c@newsgroups.borland.com>
Subject: Re: SHGetSpecialFolderLocation!
Date: Tue, 19 Aug 2003 16:40:13 -0700
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f42b3c1$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061336001 207.175.226.26 (19 Aug 2003 16:33:21 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.abs.net!ash.uu.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail