diff options
author | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-08-12 17:30:01 +0000 |
commit | 2e783a47076bd0994b6ce86df7ec967bc1c2da63 (patch) | |
tree | c6504d6e8396eef290fe499abb8586b758f1f3d4 /source3/client | |
parent | ddec8306586414cc02eca612777bb547cb8dbcae (diff) | |
download | samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.gz samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.tar.bz2 samba-2e783a47076bd0994b6ce86df7ec967bc1c2da63.zip |
this is a big global fix for the ptr = Realloc(ptr, size) bug.
many possible mem leaks, and segfaults fixed.
someone should port this fix to 2.2 also.
(This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 6 | ||||
-rw-r--r-- | source3/client/clitar.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 32cc34b225..f3cc28cc60 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -415,20 +415,22 @@ static void adjust_do_list_queue(void) static void add_to_do_list_queue(const char* entry) { + char *dlq; long new_end = do_list_queue_end + ((long)strlen(entry)) + 1; while (new_end > do_list_queue_size) { do_list_queue_size *= 2; DEBUG(4,("enlarging do_list_queue to %d\n", (int)do_list_queue_size)); - do_list_queue = Realloc(do_list_queue, do_list_queue_size); - if (! do_list_queue) { + dlq = Realloc(do_list_queue, do_list_queue_size); + if (! dlq) { DEBUG(0,("failure enlarging do_list_queue to %d bytes\n", (int)do_list_queue_size)); reset_do_list_queue(); } else { + do_list_queue = dlq; memset(do_list_queue + do_list_queue_size / 2, 0, do_list_queue_size / 2); } diff --git a/source3/client/clitar.c b/source3/client/clitar.c index d28e652b35..3ae4cafc18 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -1569,14 +1569,16 @@ static int read_inclusion_file(char *filename) } if ((strlen(buf) + 1 + inclusion_buffer_sofar) >= inclusion_buffer_size) { + char *ib; inclusion_buffer_size *= 2; - inclusion_buffer = Realloc(inclusion_buffer,inclusion_buffer_size); - if (! inclusion_buffer) { + ib = Realloc(inclusion_buffer,inclusion_buffer_size); + if (! ib) { DEBUG(0,("failure enlarging inclusion buffer to %d bytes\n", inclusion_buffer_size)); error = 1; break; } + else inclusion_buffer = ib; } safe_strcpy(inclusion_buffer + inclusion_buffer_sofar, buf, inclusion_buffer_size - inclusion_buffer_sofar); |