From: Bob D. <bd...@si...> - 2005-06-06 00:29:05
|
Hi, Patch looks good. But there are two problems. In resolution.c the strduping needs to stay. There is no guarantee that the pointer returned from data sources is going to stay where its at and it since RLIB manipulates some of that data it would be rude to change it on the datasource. But there is a serious leak there. Put the strduping back but in pcode.c line 738: Change: return rlib_value_new(rval, RLIB_VALUE_STRING, FALSE, rlib_resolve_field_value(r, o->value)); To: return rlib_value_new(rval, RLIB_VALUE_STRING, TRUE, rlib_resolve_field_value(r, o->value)); So it knows to free the string when the RVAL is freed. Second is rlib_value_dup_contents removal of the strdup. There is going to be a double free if it's not duped Follow "color" in layout.c: extra_data[i].rval_color = line_rval_color; // <--- Really a memset here rlib_value_dup_contents(&extra_data[i].rval_color); . . . rlib_value_free(&line_rval_color); . . . . and later the extra data is freed. The correct thing to do is probably is set the RVAL to free: struct rlib_value * rlib_value_dup_contents(struct rlib_value *rval) { if(rval->type == RLIB_VALUE_STRING) { rval->string_value = g_strdup(rval->string_value); rval->free = TRUE; } return rval; } Other then that great work! How did you track these down? Typically I use valgrind to find these sorta things. - bob |