On Fri, Aug 10, 2018 at 11:54:47AM +0200, Marc-André Lureau wrote: > On Fri, Aug 10, 2018 at 10:04 AM, Christophe Fergeau > <cfergeau@xxxxxxxxxx> wrote: > > This is more consistent with the rest of the codebase. > > > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > --- > > src/simpletlv.c | 25 +++++++------------------ > > 1 file changed, 7 insertions(+), 18 deletions(-) > > > > diff --git a/src/simpletlv.c b/src/simpletlv.c > > index 42ff572..17ab90e 100644 > > --- a/src/simpletlv.c > > +++ b/src/simpletlv.c > > @@ -25,6 +25,7 @@ > > #include "config.h" > > #endif > > > > +#include <glib.h> > > #include <stdio.h> > > #include <string.h> > > #include <ctype.h> > > @@ -86,10 +87,7 @@ simpletlv_encode_internal(struct simpletlv_member *tlv, size_t tlv_len, > > > > if (outlen == 0) { > > /* allocate a new buffer */ > > - a = malloc(expect_len); > > - if (a == NULL) { > > - return -1; > > - } > > + a = g_malloc(expect_len); > > tmp = a; > > tmp_len = expect_len; > > } else if ((int)outlen >= expect_len) { > > @@ -250,11 +248,9 @@ simpletlv_merge(const struct simpletlv_member *a, size_t a_len, > > struct simpletlv_member *r; > > size_t r_len = a_len + b_len; > > > > - r = malloc(r_len * sizeof(struct simpletlv_member)); > > - if (r == NULL) > > - return NULL; > > + r = g_malloc_n(r_len, sizeof(struct simpletlv_member)); > > Why not g_new? libcacard makes mixed use of g_malloc_n and g_new, I thought only g_malloc_n was used, and wanted to stay consistent. I'll change it and do the s/free/g_free at the same time. Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel