From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:2f05:: with SMTP id j5-v6mr6464470itj.37.1528058267029; Sun, 03 Jun 2018 13:37:47 -0700 (PDT) X-Received: by 2002:a9d:6218:: with SMTP id g24-v6mr428971otj.4.1528058266934; Sun, 03 Jun 2018 13:37:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.70.MISMATCH!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u74-v6no4485668itb.0!news-out.google.com!b185-v6ni4859itb.0!nntp.google.com!u74-v6no4485663itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Jun 2018 13:37:46 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2400:416e:1ba5:1200:91e3:9198:6925:ea8c; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj NNTP-Posting-Host: 2400:416e:1ba5:1200:91e3:9198:6925:ea8c References: <6ff31dc6-31e7-4755-bda0-1b53fa02f31f@googlegroups.com> <735fd76c-c0a7-4e8c-a534-857772cada9b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <38840707-7e52-4482-b74a-0b517a7720b7@googlegroups.com> Subject: Re: Interfaces.C.Strings chars_ptr memory management strategy From: ytomino Injection-Date: Sun, 03 Jun 2018 20:37:47 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2257 X-Received-Body-CRC: 3057143350 Xref: reader02.eternal-september.org comp.lang.ada:52891 Date: 2018-06-03T13:37:46-07:00 List-Id: On Monday, June 4, 2018 at 4:33:20 AM UTC+9, Dmitry A. Kazakov wrote: > On 2018-06-03 20:31, ytomino wrote: > > Perhaps, malloc is better than New_String in this case. > > > > function malloc (s : Interfaces.C.size_t) return Interfaces.C.Strings.chars_ptr > > with Import, Convention => C; > > I had a case when that caused the application crashed. > > I guess it was because of mixed Visual Studio and GCC run-times. The > pointer returned by the malloc from one was freed in a third-party C > library by another. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de By my intuition, the crash is caused by not free but Update. Because malloc does not set NUL. So maybe is the length-checking in Update crashed? If that is so, "Check => False" should be inserted into the first Update. Update (..., Check => False);