lua-users home
lua-l archive

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


On 19 October 2012 17:16, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> Nice! But it leaks an sass_context if luaL_checkstring fails.
>
> Consider changing
>
>     int struct sass_context* ctx = sass_new_context();
>     ...
>     ctx->source_string = (char*)luaL_checkstring(L, 1);
>
> to
>     char* source = (char*)luaL_checkstring(L, 1);
>     int struct sass_context* ctx = sass_new_context();
>     ...
>     ctx->source_string = source;

Thanks for the feedback! I did wonder about this when I was
typing it but my pathological urge to "save" one line of code
distracted me. I'll fix it shortly.

> BTW, I hope sass_compile does not write to source_string. But if it doesn't,
> why isn't it const?
>

I'm pretty sure sass_compile doesn't write to source_string
and I don't think there's any reason for it not being const
except an oversight by the author of libsass. I plan to report
this upstream.