summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <konstantin@oak.local>2003-11-27 19:14:16 +0300
committerunknown <konstantin@oak.local>2003-11-27 19:14:16 +0300
commit48ea56a5533f446478e5070f3fd80485a0f9fa6a (patch)
treef83c1d8f12a02cb09916872968fbd6e639cbbeff
parent443a157c6aa6bff7ed7b8dedc9c9c83be0eb8b58 (diff)
downloadmariadb-git-48ea56a5533f446478e5070f3fd80485a0f9fa6a.tar.gz
memory leak (no delete for query= new String) fixed
-rw-r--r--sql/sql_prepare.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index e76ff833e20..9f7c0bc0b0c 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -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);
}