The examples above seem to work for me and appreciate them. I'm on windows 
right now wrt to valgrind. I appreciate that it is hard to figure out what is 
happening without more code and that this thread may be getting worn out.
    
    
    ... same as code from prev snippet
    
    var foo: cstring = "abcdefg"
    
    var bar = strdup(foo)
    
    free(bar) # works no prob.
    
    var val = duckdb_value_varchar(addr(res), 0.idx_t, 0.idx_t)
    
    free(val) # SIGSEGV: Illegal storage access.
    
    
    Run

I see `*duckdb_value_varchar` uses strdup. 
    
    
    char *duckdb_value_varchar(duckdb_result *result, idx_t col, idx_t row) {
            Value val = GetCValue(result, col, row);
            return strdup(val.ToString().c_str());
    }
    
    
    Run

<https://github.com/duckdb/duckdb/blob/master/src/main/duckdb-c.cpp>

Reply via email to