On Wed, Apr 6, 2011 at 1:50 PM, Russell Bryant
<russell(a)russellbryant.net> wrote:
On Wed, Apr 6, 2011 at 2:29 AM, Andrew Beekhof
<andrew(a)beekhof.net> wrote:
> On Tue, Apr 5, 2011 at 12:54 AM, Russell Bryant
> <russell(a)russellbryant.net> wrote:
>> On Mon, Apr 4, 2011 at 5:29 AM, Andrew Beekhof <andrew(a)beekhof.net> wrote:
>>> But specifically in this case, where the input is a char* and the
>>> usage is as a char*, it doesn't make much sense to store it as a C++
>>> string in between.
>>
>> Wellll ... except that the whole point is that it does the memory
>> management for you to avoid having the type of problem I fixed.
>
> except optarg is a const char *, so no mem management necessary :)
Sure, optarg is, but not where it was being copied to. The problems
were the strdup()s of optarg. That's (unnecessary) manual memory
management.
Ok, then just drop the strdup()