Commit 48ea56a5 authored by unknown's avatar unknown

memory leak (no delete for query= new String) fixed

parent 443a157c
......@@ -426,8 +426,10 @@ static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
Item_param *param;
DBUG_ENTER("insert_params_withlog");
String str, *res, *query= new String(stmt->query->alloced_length());
query->copy(*stmt->query);
String str, query, *res;
if (query.copy(*stmt->query))
DBUG_RETURN(1);
ulong param_no= 0;
uint32 length= 0;
......@@ -451,16 +453,14 @@ static bool insert_params_withlog(PREP_STMT *stmt, uchar *pos, uchar *read_pos)
res= param->query_val_str(&str);
}
}
if (query->replace(param->pos_in_query+length, 1, *res))
if (query.replace(param->pos_in_query+length, 1, *res))
DBUG_RETURN(1);
length+= res->length()-1;
param_no++;
}
if (alloc_query(stmt->thd, (char *)query->ptr(), query->length()+1))
if (alloc_query(thd, (char *)query.ptr(), query.length()+1))
DBUG_RETURN(1);
query->free();
DBUG_RETURN(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment