On Sun, Mar 19, 2017 at 04:27:15PM +0000, Saurav Sachidanand wrote: > @@ -48,10 +46,10 @@ envlist_free(envlist_t *envlist) > entry = envlist->el_entries.lh_first; > QLIST_REMOVE(entry, ev_link); > > - free((char *)entry->ev_var); > + g_free(entry->ev_var);
You need to keep the const casts to silence the compiler. Here, ... > @@ -155,18 +152,14 @@ envlist_setenv(envlist_t *envlist, const char *env) > > if (entry != NULL) { > QLIST_REMOVE(entry, ev_link); > - free((char *)entry->ev_var); > + g_free(entry->ev_var); here, ... > @@ -201,8 +194,8 @@ envlist_unsetenv(envlist_t *envlist, const char *env) > } > if (entry != NULL) { > QLIST_REMOVE(entry, ev_link); > - free((char *)entry->ev_var); > + g_free(entry->ev_var); and here. The problem is that const char * is not supposed to be freed. The type would need to be non-const. Most of the code does treat the string as const, so it's nice to have it except for the final free().
signature.asc
Description: PGP signature