The bincode component should not be in charge of allocating any memory, and the only function doing so was bincode_getstr(). It is essentially like bincode_getbytes() but for the signedness of the type and the placement of the terminating zero byte at the end of the string.
Changing _getstr() to require a destination buffer allows removing an import of stdlib.h as well.
7NQTS36DJ6GRXMZDNMORKPWF7VBESQY4DH2XFI7VI2A2JVMFIK5AC HFRFMZ63OX7NTVS4SKINFGQWM67AJVAXHTXRJUWWDQTC5NM55MEQC 5D2IYPL75HEP6JUEILEADSZRRSV72NECT6UQR3PORNDR35I2P5GQC YFBKBUKBX3JB7OCB4D3ZKSLWTP6QWZ36HEE5GZROJE55RK33MZCAC Q7TKZCJP2Z75EICZYKCEZDHKGERSOKZGMTSU3UXETBHTF663T66AC JAGXXSR7DR5FG77VKBF62BW7Q3JMVHCLHF4VB2PSLIZF4RLE553QC 33ZXTRXRO7X7M2F5TM55CDE45RYVEYO5JGWULEJ337OHHQBO325QC 2LYNPDBTIKRIG2MJSCNGFW3Y2CBWCQMYWGR4PUEVB3G3TCCPMCPQC 7WA2F6RSQBGJJE5MZGQGAYJOWYEKQUWVI2MTZ4AMICEEQFENXANQC Y26WT3ZFN7KSVXOZ26B5Y2OR4M4VQYQLPMAHPC4O5VIT3ENBISXAC QYRJIOYPM7SAB3OHMALL67K44U5HPBRQ2AFNWUKATPXM6BUYRKBQC XTKRT6OQYN4LARQRDLI2KBSAJTOFZNT4AMBZ46CPUDZXD7IDYYWQC LCEKN25G5GFBUWWQAR4REIGPOL6JYNDWLNCDJGZQKOWIDHGIRMZAC NEORNIZEGPZAVZV2J6TTCWPZAQM3N7MH7SMS3NDT4WKTXI34NSUAC JVU3TTT5T776LB2UNT5DCISJDWOITRSJPRG3CDTX4NDQEHC5VI3QC 4RYULBDDDIVSJTIOTBBSQAWMSN6ZBZEFJ6UR7P6ECEXEXTGPMUOAC VXGUQZIVOLPAPINOY3EMFDHLFNBI3H6BNYYENS7P4G2WT4CCWCAQC LVX6U4EKYXM6H32X5SZS4UBIM5PW4ND4F4QQOF5EQDX3DUHBYFGAC * Allocate and return a string of the given length.** The memory allocated shall be the given length plus one, to hold the* terminating zero.** Returns the allocated string. The caller is responsible for deallocating.
* Fill in a string of the given length, the destination should have* sufficient space.
char *str;uint8_t *b;b = s->buf;str = xmalloc(len + 1);memcpy(str, b, len);str[len] = '\0';
memcpy(str, s->buf, len);