Skip to content

Memory leak in byte_buffer.c in PHP extension library #279

@jtattermusch

Description

@jtattermusch

string_to_byte_buffer does call gpr_slice_unref() .

gpr_slice slice = gpr_slice_malloc(length);
memcpy(GPR_SLICE_START_PTR(slice), string, length);
return grpc_byte_buffer_create(&slice, 1);

suggested fix:
gpr_slice slice =
gpr_slice_from_copied_buffer(msg_str.data(), msg_str.length());
grpc_byte_buffer *bb = grpc_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions