From 2f844bf447a98b802daa4b8d552ea4530e7f6108 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 8 Aug 2001 16:54:16 +0000 Subject: Change all realloc() statements to Realloc() (ecxept for tdb.c) changed some code to exploit the fact that Realloc(NULL, size) == malloc(size) fixed some possible mem leaks, or seg faults. thanks to andreas moroder (mallocs not checked in client/client.c, client/smbumount.c) (This used to be commit 7f33c01688b825ab2fa9bbb2730bff4f2fa352be) --- source3/client/client.c | 4 ++++ source3/client/smbumount.c | 5 +++++ 2 files changed, 9 insertions(+) (limited to 'source3/client') diff --git a/source3/client/client.c b/source3/client/client.c index 479c4f764f..32cc34b225 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1013,6 +1013,10 @@ static void do_put(char *rname,char *lname) rname)); buf = (char *)malloc(maxwrite); + if (!buf) { + DEBUG(0, ("ERROR: Not enough memory!\n")); + return; + } while (!feof(f)) { int n = maxwrite; int ret; diff --git a/source3/client/smbumount.c b/source3/client/smbumount.c index dacf4ab67d..983ad44fa0 100644 --- a/source3/client/smbumount.c +++ b/source3/client/smbumount.c @@ -74,6 +74,11 @@ canonicalize (char *path) { char *canonical = malloc (PATH_MAX + 1); + if (!canonical) { + fprintf(stderr, "Error! Not enough memory!\n"); + return NULL; + } + if (strlen(path) > PATH_MAX) { fprintf(stderr, "Mount point string too long\n"); return NULL; -- cgit