commit | bd2e2a4792b126a9671dc081181be85d749fe4ad | [log] [tgz] |
---|---|---|
author | Hasnain Lakhani <m.hasnain.lakhani@gmail.com> | Sat May 24 12:18:57 2025 -0700 |
committer | Jens Geyer <Jens-G@users.noreply.github.com> | Sun May 25 14:46:06 2025 +0200 |
tree | 2d406f8086f757f41c7aac715b936ecac3e0bf18 | |
parent | b0252a9b43d54ddddee9ff0db95e9c4372b0ff77 [diff] |
[nit] Return early if no bytes left to return in thrift_memory_buffer_read
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c index d38d494..9ef0057 100644 --- a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c +++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
@@ -91,6 +91,10 @@ give = t->buf->len; } + if (give == 0) { + return -1; + } + memcpy (buf, t->buf->data, give); g_byte_array_remove_range (t->buf, 0, give);