stack trace for bug #755

Lubomir I. Ivanov neolit123 at gmail.com
Tue Nov 11 11:46:19 PST 2014


On 11 November 2014 21:20, Linus Torvalds <torvalds at linux-foundation.org> wrote:
> On Tue, Nov 11, 2014 at 5:45 AM, Miika Turkia <miika.turkia at gmail.com> 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
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-maintab.cpp-use-copy_string-instead-of-strdup.patch
Type: application/octet-stream
Size: 1286 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141111/c1d6fba9/attachment.obj>


More information about the subsurface mailing list