mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
move to SAFE_FREE()
This commit is contained in:
parent
b7edd55885
commit
29db6ef7a7
@ -193,7 +193,7 @@ static void writetarheader(int f, char *aname, int size, time_t mtime,
|
|||||||
i = strlen(b)+1;
|
i = strlen(b)+1;
|
||||||
DEBUG(5, ("File name in tar file: %s, size=%d, \n", b, (int)strlen(b)));
|
DEBUG(5, ("File name in tar file: %s, size=%d, \n", b, (int)strlen(b)));
|
||||||
dotarbuf(f, b, TBLOCK*(((i-1)/TBLOCK)+1));
|
dotarbuf(f, b, TBLOCK*(((i-1)/TBLOCK)+1));
|
||||||
free(b);
|
SAFE_FREE(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* use l + 1 to do the null too */
|
/* use l + 1 to do the null too */
|
||||||
@ -1190,7 +1190,7 @@ static void do_tarput(void)
|
|||||||
|
|
||||||
if (longfilename != NULL) {
|
if (longfilename != NULL) {
|
||||||
|
|
||||||
free(finfo.name); /* Free the space already allocated */
|
SAFE_FREE(finfo.name); /* Free the space already allocated */
|
||||||
finfo.name = longfilename;
|
finfo.name = longfilename;
|
||||||
longfilename = NULL;
|
longfilename = NULL;
|
||||||
|
|
||||||
@ -1416,7 +1416,7 @@ void cmd_tar(void)
|
|||||||
|
|
||||||
process_tar();
|
process_tar();
|
||||||
|
|
||||||
free(argl);
|
SAFE_FREE(argl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1433,7 +1433,7 @@ int process_tar(void)
|
|||||||
#else
|
#else
|
||||||
do_tarput();
|
do_tarput();
|
||||||
#endif
|
#endif
|
||||||
free(tarbuf);
|
SAFE_FREE(tarbuf);
|
||||||
close(tarhandle);
|
close(tarhandle);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -1483,7 +1483,7 @@ int process_tar(void)
|
|||||||
|
|
||||||
if (ntarf) dotareof(tarhandle);
|
if (ntarf) dotareof(tarhandle);
|
||||||
close(tarhandle);
|
close(tarhandle);
|
||||||
free(tarbuf);
|
SAFE_FREE(tarbuf);
|
||||||
|
|
||||||
DEBUG(0, ("tar: dumped %d files and directories\n", ntarf));
|
DEBUG(0, ("tar: dumped %d files and directories\n", ntarf));
|
||||||
DEBUG(0, ("Total bytes written: %.0f\n", (double)ttarf));
|
DEBUG(0, ("Total bytes written: %.0f\n", (double)ttarf));
|
||||||
@ -1493,9 +1493,9 @@ int process_tar(void)
|
|||||||
if (must_free_cliplist) {
|
if (must_free_cliplist) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < clipn; ++i) {
|
for (i = 0; i < clipn; ++i) {
|
||||||
free(cliplist[i]);
|
SAFE_FREE(cliplist[i]);
|
||||||
}
|
}
|
||||||
free(cliplist);
|
SAFE_FREE(cliplist);
|
||||||
cliplist = NULL;
|
cliplist = NULL;
|
||||||
clipn = 0;
|
clipn = 0;
|
||||||
must_free_cliplist = False;
|
must_free_cliplist = False;
|
||||||
@ -1615,17 +1615,15 @@ static int read_inclusion_file(char *filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inclusion_buffer) {
|
SAFE_FREE(inclusion_buffer);
|
||||||
free(inclusion_buffer);
|
|
||||||
}
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (cliplist) {
|
if (cliplist) {
|
||||||
char **pp;
|
char **pp;
|
||||||
/* We know cliplist is always null-terminated */
|
/* We know cliplist is always null-terminated */
|
||||||
for (pp = cliplist; *pp; ++pp) {
|
for (pp = cliplist; *pp; ++pp) {
|
||||||
free(*pp);
|
SAFE_FREE(*pp);
|
||||||
}
|
}
|
||||||
free(cliplist);
|
SAFE_FREE(cliplist);
|
||||||
cliplist = NULL;
|
cliplist = NULL;
|
||||||
must_free_cliplist = False;
|
must_free_cliplist = False;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ static struct cli_state *do_connection(char *service)
|
|||||||
DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
|
DEBUG(0,("%d: Connection to %s failed\n", getpid(), server_n));
|
||||||
if (c) {
|
if (c) {
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ static struct cli_state *do_connection(char *service)
|
|||||||
DEBUG(0,("%d: session request to %s failed (%s)\n",
|
DEBUG(0,("%d: session request to %s failed (%s)\n",
|
||||||
getpid(), called.name, cli_errstr(c)));
|
getpid(), called.name, cli_errstr(c)));
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
if ((p=strchr_m(called.name, '.'))) {
|
if ((p=strchr_m(called.name, '.'))) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
goto again;
|
goto again;
|
||||||
@ -180,7 +180,7 @@ static struct cli_state *do_connection(char *service)
|
|||||||
if (!cli_negprot(c)) {
|
if (!cli_negprot(c)) {
|
||||||
DEBUG(0,("%d: protocol negotiation failed\n", getpid()));
|
DEBUG(0,("%d: protocol negotiation failed\n", getpid()));
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ static struct cli_state *do_connection(char *service)
|
|||||||
DEBUG(0,("%d: session setup failed: %s\n",
|
DEBUG(0,("%d: session setup failed: %s\n",
|
||||||
getpid(), cli_errstr(c)));
|
getpid(), cli_errstr(c)));
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ static struct cli_state *do_connection(char *service)
|
|||||||
DEBUG(0,("%d: tree connect failed: %s\n",
|
DEBUG(0,("%d: tree connect failed: %s\n",
|
||||||
getpid(), cli_errstr(c)));
|
getpid(), cli_errstr(c)));
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,8 +358,7 @@ static void send_fs_socket(char *service, char *mount_point, struct cli_state *c
|
|||||||
If we don't do this we will "leak" sockets and memory on
|
If we don't do this we will "leak" sockets and memory on
|
||||||
each reconnection we have to make. */
|
each reconnection we have to make. */
|
||||||
cli_shutdown(c);
|
cli_shutdown(c);
|
||||||
free(c);
|
SAFE_FREE(c);
|
||||||
c = NULL;
|
|
||||||
|
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
/* redirect stdout & stderr since we can't know that
|
/* redirect stdout & stderr since we can't know that
|
||||||
|
Loading…
Reference in New Issue
Block a user