Message ID | 1330682462-18287-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On Fri, Mar 2, 2012 at 6:01 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/lib/src/fwts_tag.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/lib/src/fwts_tag.c b/src/lib/src/fwts_tag.c > index 76c84ec..24e0b53 100644 > --- a/src/lib/src/fwts_tag.c > +++ b/src/lib/src/fwts_tag.c > @@ -158,11 +158,13 @@ char *fwts_tag_list_to_str(fwts_list *taglist) > len += taglen + 1; > > if (str) { > - str = realloc(str, len); > + if ((str = realloc(str, len)) == NULL) > + return NULL; > strcat(str, " "); > strcat(str, tag); > } else { > - str = malloc(len); > + if ((str = malloc(len)) == NULL) > + return NULL; > strcpy(str, tag); > } > } > -- > 1.7.9 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
On 03/02/2012 06:01 PM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > Signed-off-by: Colin Ian King<colin.king@canonical.com> > --- > src/lib/src/fwts_tag.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/lib/src/fwts_tag.c b/src/lib/src/fwts_tag.c > index 76c84ec..24e0b53 100644 > --- a/src/lib/src/fwts_tag.c > +++ b/src/lib/src/fwts_tag.c > @@ -158,11 +158,13 @@ char *fwts_tag_list_to_str(fwts_list *taglist) > len += taglen + 1; > > if (str) { > - str = realloc(str, len); > + if ((str = realloc(str, len)) == NULL) > + return NULL; > strcat(str, " "); > strcat(str, tag); > } else { > - str = malloc(len); > + if ((str = malloc(len)) == NULL) > + return NULL; > strcpy(str, tag); > } > } Acked-by: Alex Hung <alex.hung@canonical.com>
diff --git a/src/lib/src/fwts_tag.c b/src/lib/src/fwts_tag.c index 76c84ec..24e0b53 100644 --- a/src/lib/src/fwts_tag.c +++ b/src/lib/src/fwts_tag.c @@ -158,11 +158,13 @@ char *fwts_tag_list_to_str(fwts_list *taglist) len += taglen + 1; if (str) { - str = realloc(str, len); + if ((str = realloc(str, len)) == NULL) + return NULL; strcat(str, " "); strcat(str, tag); } else { - str = malloc(len); + if ((str = malloc(len)) == NULL) + return NULL; strcpy(str, tag); } }