Message ID | 1330682626-18579-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On Fri, Mar 2, 2012 at 6:03 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_stringextras.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c > index df0608d..babf2ed 100644 > --- a/src/lib/src/fwts_stringextras.c > +++ b/src/lib/src/fwts_stringextras.c > @@ -54,7 +54,8 @@ char *fwts_realloc_strcat(char *orig, const char *newstr) > return NULL; > strcat(orig, newstr); > } else { > - orig = malloc(newlen + 1); > + if ((orig = malloc(newlen + 1)) == NULL) > + return NULL; > strcpy(orig, newstr); > } > return orig; > -- > 1.7.9 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
On Fri, Mar 2, 2012 at 6:03 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_stringextras.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c > index df0608d..babf2ed 100644 > --- a/src/lib/src/fwts_stringextras.c > +++ b/src/lib/src/fwts_stringextras.c > @@ -54,7 +54,8 @@ char *fwts_realloc_strcat(char *orig, const char *newstr) > return NULL; > strcat(orig, newstr); > } else { > - orig = malloc(newlen + 1); > + if ((orig = malloc(newlen + 1)) == NULL) > + return NULL; > strcpy(orig, newstr); > } > return orig; > -- > 1.7.9 > Acked-by: Alex Hung<alex.hung@canonical.com>
diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c index df0608d..babf2ed 100644 --- a/src/lib/src/fwts_stringextras.c +++ b/src/lib/src/fwts_stringextras.c @@ -54,7 +54,8 @@ char *fwts_realloc_strcat(char *orig, const char *newstr) return NULL; strcat(orig, newstr); } else { - orig = malloc(newlen + 1); + if ((orig = malloc(newlen + 1)) == NULL) + return NULL; strcpy(orig, newstr); } return orig;