Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf215d8

Browse files
committed
Suppress some more valgrind whining about btree_gist.
A couple of functions didn't bother to zero out pad bytes in datums thatwould ultimately go to disk. Harmless, but valgrind doesn't know that.
1 parent39586bc commitaf215d8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎contrib/btree_gist/btree_utils_var.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,21 @@ GBT_VARKEY *
7070
gbt_var_key_copy(constGBT_VARKEY_R*u,boolforce_node)
7171
{
7272
GBT_VARKEY*r=NULL;
73+
int32lowersize=VARSIZE(u->lower);
74+
int32uppersize=VARSIZE(u->upper);
7375

7476
if (u->lower==u->upper&& !force_node)
7577
{/* leaf key mode */
76-
r= (GBT_VARKEY*)palloc(VARSIZE(u->lower)+VARHDRSZ);
77-
memcpy(VARDATA(r),u->lower,VARSIZE(u->lower));
78-
SET_VARSIZE(r,VARSIZE(u->lower)+VARHDRSZ);
78+
r= (GBT_VARKEY*)palloc(lowersize+VARHDRSZ);
79+
memcpy(VARDATA(r),u->lower,lowersize);
80+
SET_VARSIZE(r,lowersize+VARHDRSZ);
7981
}
8082
else
8183
{/* node key mode */
82-
r= (GBT_VARKEY*)palloc(INTALIGN(VARSIZE(u->lower))+VARSIZE(u->upper)+VARHDRSZ);
83-
memcpy(VARDATA(r),u->lower,VARSIZE(u->lower));
84-
memcpy(VARDATA(r)+INTALIGN(VARSIZE(u->lower)),u->upper,VARSIZE(u->upper));
85-
SET_VARSIZE(r,INTALIGN(VARSIZE(u->lower))+VARSIZE(u->upper)+VARHDRSZ);
84+
r= (GBT_VARKEY*)palloc0(INTALIGN(lowersize)+uppersize+VARHDRSZ);
85+
memcpy(VARDATA(r),u->lower,lowersize);
86+
memcpy(VARDATA(r)+INTALIGN(lowersize),u->upper,uppersize);
87+
SET_VARSIZE(r,INTALIGN(lowersize)+uppersize+VARHDRSZ);
8688
}
8789
returnr;
8890
}
@@ -201,7 +203,7 @@ gbt_var_node_truncate(const GBT_VARKEY *node, int32 cpf_length, const gbtree_vin
201203
len2=Min(len2, (cpf_length+1));
202204

203205
si=2*VARHDRSZ+INTALIGN(len1+VARHDRSZ)+len2;
204-
out= (GBT_VARKEY*)palloc(si);
206+
out= (GBT_VARKEY*)palloc0(si);
205207
SET_VARSIZE(out,si);
206208

207209
memcpy(VARDATA(out),r.lower,len1+VARHDRSZ);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp