On 11 November 2014 21:20, Linus Torvalds <[email protected]> wrote:
> On Tue, Nov 11, 2014 at 5:45 AM, Miika Turkia <[email protected]> wrote:
>>
>> And the line calling strdup (in case my sources are slightly off sync):
>>
>>         if (!same_string(displayedTrip.location, currentTrip->location)) {
>>                 currentTrip->location = strdup(displayedTrip.location);
>>                 mark_divelist_changed(true);
>>         }
>
> That "strdup()" really should be "copy_string()".
>
> The whole "same_string()" thing counts NULL as en empty string, so it
> allows NULL. And that's *exactly* why we have "copy_string()" too,
> allowing NULL (which will be copied as NULL).
>

here is a patch for that.
no crash occurs on win32, yet i can see NULL values reaching the
same_string() checks.

lubomir
--

Attachment: 0001-maintab.cpp-use-copy_string-instead-of-strdup.patch
Description: Binary data

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to