* tcputil.c (rpc_get): Add missing va_end()s. Fix memory leaking.

This commit is contained in:
Andrew V. Samoilov 2001-10-25 07:57:15 +00:00
parent fcce6d2bb0
commit 3767e8e5df
2 changed files with 16 additions and 5 deletions

View File

@ -1,5 +1,7 @@
2001-10-24 Andrew V. Samoilov <kai@cmail.ru>
* tcputil.c (rpc_get): Add missing va_end()s.
Fix memory leaking.
* smbfs.h: Declare smbfs_set_debug.
2001-10-20 Pavel Roskin <proski@gnu.org>
@ -19,7 +21,7 @@
long. This should fix uploading when large file support is on.
File size is limited to 4096 * ULONG_MAX for now.
2001-10-18 Andrew V. Samoilov <kai@cmail.ru
2001-10-18 Andrew V. Samoilov <kai@cmail.ru>
* samba/configure.in: Don't check readline.h, history.h and
libreadline.

View File

@ -188,8 +188,10 @@ int rpc_get (int sock, ...)
return 1;
case RPC_INT:
if (socket_read_block (sock, (char *) &tmp, sizeof (tmp)) == 0)
if (socket_read_block (sock, (char *) &tmp, sizeof (tmp)) == 0){
va_end (ap);
return 0;
}
dest = va_arg (ap, int *);
*dest = ntohl (tmp);
break;
@ -197,8 +199,10 @@ int rpc_get (int sock, ...)
/* returns an allocated string */
case RPC_LIMITED_STRING:
case RPC_STRING:
if (socket_read_block (sock, (char *)&tmp, sizeof (tmp)) == 0)
if (socket_read_block (sock, (char *)&tmp, sizeof (tmp)) == 0){
va_end (ap);
return 0;
}
len = ntohl (tmp);
if (cmd == RPC_LIMITED_STRING)
if (len > 16*1024){
@ -208,8 +212,11 @@ int rpc_get (int sock, ...)
if (len > 128*1024)
abort ();
text = g_new0 (char, len+1);
if (socket_read_block (sock, text, len) == 0)
if (socket_read_block (sock, text, len) == 0){
g_free (text);
va_end (ap);
return 0;
}
str_dest = va_arg (ap, char **);
*str_dest = text;
text [len] = '\0';
@ -218,8 +225,10 @@ int rpc_get (int sock, ...)
case RPC_BLOCK:
len = va_arg (ap, int);
text = va_arg (ap, char *);
if (socket_read_block (sock, text, len) == 0)
if (socket_read_block (sock, text, len) == 0){
va_end (ap);
return 0;
}
break;
default: