help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using evalstring from a loadable builtin


From: Marco Maggi
Subject: using evalstring from a loadable builtin
Date: Mon, 04 Nov 2024 11:52:35 +0100

Ciao,

  I'm  using GNU  Bash 5.1.16(1)-release;  am I  allowed to  call the  C
function "evalstring()" from a loadable builtin?  With some incantation?

  If I try it with an ASCIIZ string of which the caller owns the memory:

    evalstring(script_string, "whatever", SEVAL_NOHIST);
    free(script_string);

I get:

malloc: dispose_cmd.c:249: assertion botched
free: called with already freed block argument
Aborting...

while if I duplicate the string argument with and never release it seems
to work:

    script_string = strdup(script_string);
    evalstring(script_string, "whatever", SEVAL_NOHIST);
    free(script_string);

but I'm not sure.
-- 
Marco



reply via email to

[Prev in Thread] Current Thread [Next in Thread]