diff options
author | Gerald Carter <jerry@samba.org> | 2006-02-21 15:47:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:16 -0500 |
commit | 67c7693ebbd5aa675b8698af5695513c32828e3d (patch) | |
tree | 0c210bd3fb08767fc92145447e5436024e07abe5 | |
parent | cd559192633d78a9f06e239c6a448955f6ea0842 (diff) | |
download | samba-67c7693ebbd5aa675b8698af5695513c32828e3d.tar.gz samba-67c7693ebbd5aa675b8698af5695513c32828e3d.tar.bz2 samba-67c7693ebbd5aa675b8698af5695513c32828e3d.zip |
r13591: I really have no idea how this code ever worked. And I have
no idea why no one (including myself) caught this with a compiler
warning....Make sure new_chunk() actually returns a pointer
to the allocated memory.
SAMBA_3_0 now works again on Solaris.
(This used to be commit cf9140ad266a8a710651570d0af8dc6188fafed0)
-rw-r--r-- | source3/lib/snprintf.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c index 379e15cf6d..5d89aa841f 100644 --- a/source3/lib/snprintf.c +++ b/source3/lib/snprintf.c @@ -1112,25 +1112,28 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) } static struct pr_chunk *new_chunk(void) { - struct pr_chunk *new = (struct pr_chunk *)malloc(sizeof(struct pr_chunk)); - - if (!new) return NULL; - - new->type = 0; - new->num = 0; - new->min = 0; - new->min_star = NULL; - new->max = -1; - new->max_star = NULL; - new->flags = 0; - new->cflags = 0; - new->start = 0; - new->len = 0; - new->value = 0; - new->fvalue = 0; - new->strvalue = NULL; - new->pnum = NULL; - new->next = NULL; + struct pr_chunk *new_c = (struct pr_chunk *)malloc(sizeof(struct pr_chunk)); + + if ( !new_c ) + return NULL; + + new_c->type = 0; + new_c->num = 0; + new_c->min = 0; + new_c->min_star = NULL; + new_c->max = -1; + new_c->max_star = NULL; + new_c->flags = 0; + new_c->cflags = 0; + new_c->start = 0; + new_c->len = 0; + new_c->value = 0; + new_c->fvalue = 0; + new_c->strvalue = NULL; + new_c->pnum = NULL; + new_c->next = NULL; + + return new_c; } static int add_cnk_list_entry(struct pr_chunk_x **list, |