From ab92944576d829805cb171f9e59e6b138a70da3d Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Fri, 25 Dec 2009 11:30:10 +0000
Subject: [PATCH] replacing 'free()' or 'free ()' by 'g_free ()'
---
src/man2hlp.c | 12 ++++++------
src/pipethrough.c | 4 ++--
vfs/mcfsutil.c | 2 +-
vfs/samba/lib/charset.c | 4 ++--
vfs/samba/lib/username.c | 2 +-
vfs/samba/lib/util.c | 20 ++++++++++----------
vfs/samba/lib/util_file.c | 2 +-
vfs/samba/lib/util_str.c | 2 +-
vfs/samba/libsmb/clientgen.c | 34 +++++++++++++++++-----------------
9 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/src/man2hlp.c b/src/man2hlp.c
index aa95df6..1dd858f 100644
a
|
b
|
main (int argc, char **argv) |
822 | 822 | in_row = current_link->line; |
823 | 823 | print_error (buffer); |
824 | 824 | } |
825 | | free (current_link->linkname); |
| 825 | g_free (current_link->linkname); |
826 | 826 | if (current_link != &links) |
827 | | free (current_link); |
| 827 | g_free (current_link); |
828 | 828 | current_link = next; |
829 | 829 | } |
830 | 830 | |
… |
… |
main (int argc, char **argv) |
837 | 837 | "", cnode->lname ? cnode->lname : lc_node, lc_node); |
838 | 838 | fprintf (f_out, "\n"); |
839 | 839 | |
840 | | free (cnode->node); |
| 840 | g_free (cnode->node); |
841 | 841 | if (cnode->lname) |
842 | | free (cnode->lname); |
| 842 | g_free (cnode->lname); |
843 | 843 | if (cnode != &nodes) |
844 | | free (cnode); |
| 844 | g_free (cnode); |
845 | 845 | cnode = next; |
846 | 846 | } |
847 | 847 | |
… |
… |
main (int argc, char **argv) |
891 | 891 | return 1; |
892 | 892 | } |
893 | 893 | |
894 | | free (outfile_buffer); |
| 894 | g_free (outfile_buffer); |
895 | 895 | fclose_check (f_out); |
896 | 896 | /* Closing everything */ |
897 | 897 | |
diff --git a/src/pipethrough.c b/src/pipethrough.c
index e31f816..bc6528c 100644
a
|
b
|
static void reader_buffer_finalize(/*@special@*/ struct reader_buffer *buf) |
156 | 156 | /*@releases buf->data; @*/ |
157 | 157 | { |
158 | 158 | if (buf->data != NULL) { |
159 | | free(buf->data); |
| 159 | g_free (buf->data); |
160 | 160 | buf->data = NULL; |
161 | 161 | } |
162 | 162 | buf->size = 0; |
… |
… |
extern void pipe_outbuffer_finalize(struct pipe_outbuffer *buf) |
450 | 450 | /*@ensures isnull buf->data; @*/ |
451 | 451 | { |
452 | 452 | if (buf->data != NULL) { |
453 | | free(buf->data); |
| 453 | g_free (buf->data); |
454 | 454 | buf->data = NULL; |
455 | 455 | } |
456 | 456 | buf->size = 0; |
diff --git a/vfs/mcfsutil.c b/vfs/mcfsutil.c
index d3c2e04..be7bf5a 100644
a
|
b
|
rpc_get (int sock, ...) |
186 | 186 | /* Don't use glib functions here - this code is used by mcserv */ |
187 | 187 | text = malloc (len + 1); |
188 | 188 | if (socket_read_block (sock, text, len) == 0) { |
189 | | free (text); |
| 189 | g_free (text); |
190 | 190 | va_end (ap); |
191 | 191 | return 0; |
192 | 192 | } |
diff --git a/vfs/samba/lib/charset.c b/vfs/samba/lib/charset.c
index 35f9126..f65b950 100644
a
|
b
|
clean_and_exit: |
315 | 315 | if(fp != NULL) |
316 | 316 | fclose(fp); |
317 | 317 | if(cp_p) |
318 | | free((char *)cp_p); |
| 318 | g_free ((char *)cp_p); |
319 | 319 | return NULL; |
320 | 320 | } |
321 | 321 | |
… |
… |
void add_char_string(const char *s) |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | | free(extra_chars); |
| 395 | g_free (extra_chars); |
396 | 396 | } |
diff --git a/vfs/samba/lib/username.c b/vfs/samba/lib/username.c
index aaec3c7..abeb2ce 100644
a
|
b
|
static struct passwd *_Get_Pwnam(const char *s) |
160 | 160 | pwret = getpwanam(s); |
161 | 161 | if (pwret) |
162 | 162 | { |
163 | | free(ret->pw_passwd); |
| 163 | g_free (ret->pw_passwd); |
164 | 164 | ret->pw_passwd = pwret->pwa_passwd; |
165 | 165 | } |
166 | 166 | #endif |
diff --git a/vfs/samba/lib/util.c b/vfs/samba/lib/util.c
index da2fa83..adda79c 100644
a
|
b
|
void *Realloc(void *p,size_t size) |
1642 | 1642 | void *ret=NULL; |
1643 | 1643 | |
1644 | 1644 | if (size == 0) { |
1645 | | if (p) free(p); |
| 1645 | if (p) g_free (p); |
1646 | 1646 | DEBUG(5,("Realloc asked for 0 bytes\n")); |
1647 | 1647 | return NULL; |
1648 | 1648 | } |
… |
… |
struct hostent *Get_Hostbyname(const char *name) |
2251 | 2251 | #if 0 |
2252 | 2252 | if (!isalnum(*name2)) |
2253 | 2253 | { |
2254 | | free(name2); |
| 2254 | g_free (name2); |
2255 | 2255 | return(NULL); |
2256 | 2256 | } |
2257 | 2257 | #endif /* 0 */ |
… |
… |
struct hostent *Get_Hostbyname(const char *name) |
2259 | 2259 | ret = sys_gethostbyname(name2); |
2260 | 2260 | if (ret != NULL) |
2261 | 2261 | { |
2262 | | free(name2); |
| 2262 | g_free (name2); |
2263 | 2263 | return(ret); |
2264 | 2264 | } |
2265 | 2265 | |
… |
… |
struct hostent *Get_Hostbyname(const char *name) |
2268 | 2268 | ret = sys_gethostbyname(name2); |
2269 | 2269 | if (ret != NULL) |
2270 | 2270 | { |
2271 | | free(name2); |
| 2271 | g_free (name2); |
2272 | 2272 | return(ret); |
2273 | 2273 | } |
2274 | 2274 | |
… |
… |
struct hostent *Get_Hostbyname(const char *name) |
2277 | 2277 | ret = sys_gethostbyname(name2); |
2278 | 2278 | if (ret != NULL) |
2279 | 2279 | { |
2280 | | free(name2); |
| 2280 | g_free (name2); |
2281 | 2281 | return(ret); |
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | /* nothing works :-( */ |
2285 | | free(name2); |
| 2285 | g_free (name2); |
2286 | 2286 | return(NULL); |
2287 | 2287 | } |
2288 | 2288 | |
… |
… |
void free_namearray(name_compare_entry *name_array) |
2533 | 2533 | return; |
2534 | 2534 | |
2535 | 2535 | if(name_array->name != NULL) |
2536 | | free(name_array->name); |
| 2536 | g_free (name_array->name); |
2537 | 2537 | |
2538 | | free((char *)name_array); |
| 2538 | g_free ((char *)name_array); |
2539 | 2539 | } |
2540 | 2540 | |
2541 | 2541 | /**************************************************************************** |
… |
… |
int str_checksum(const char *s) |
2841 | 2841 | /***************************************************************** |
2842 | 2842 | zero a memory area then free it. Used to catch bugs faster |
2843 | 2843 | *****************************************************************/ |
2844 | | void zero_free(void *p, size_t size) |
| 2844 | void zero_free (void *p, size_t size) |
2845 | 2845 | { |
2846 | 2846 | memset(p, 0, size); |
2847 | | free(p); |
| 2847 | g_free (p); |
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | |
diff --git a/vfs/samba/lib/util_file.c b/vfs/samba/lib/util_file.c
index 502f8c7..9db0be2 100644
a
|
b
|
char *fgets_slash(char *s2,int maxlen,FILE *f) |
308 | 308 | return(s); |
309 | 309 | case EOF: |
310 | 310 | if (len <= 0 && !s2) |
311 | | free(s); |
| 311 | g_free (s); |
312 | 312 | return(len>0?s:NULL); |
313 | 313 | case ' ': |
314 | 314 | if (start_of_line) |
diff --git a/vfs/samba/lib/util_str.c b/vfs/samba/lib/util_str.c
index 74b5303..fd83067 100644
a
|
b
|
void string_free(char **s) |
980 | 980 | if (!s || !(*s)) return; |
981 | 981 | if (*s == null_string) |
982 | 982 | *s = NULL; |
983 | | if (*s) free(*s); |
| 983 | if (*s) g_free (*s); |
984 | 984 | *s = NULL; |
985 | 985 | } |
986 | 986 | |
diff --git a/vfs/samba/libsmb/clientgen.c b/vfs/samba/libsmb/clientgen.c
index 0dd0710..05b7be3 100644
a
|
b
|
BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation) |
528 | 528 | } |
529 | 529 | |
530 | 530 | if (rparam) |
531 | | free(rparam); |
| 531 | g_free (rparam); |
532 | 532 | if (rdata) |
533 | | free(rdata); |
| 533 | g_free (rdata); |
534 | 534 | return (cli->rap_error == 0); |
535 | 535 | } |
536 | 536 | #endif /*0 */ |
… |
… |
int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co |
592 | 592 | } |
593 | 593 | |
594 | 594 | if (rparam) |
595 | | free(rparam); |
| 595 | g_free (rparam); |
596 | 596 | if (rdata) |
597 | | free(rdata); |
| 597 | g_free (rdata); |
598 | 598 | |
599 | 599 | return count; |
600 | 600 | } |
… |
… |
BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, |
665 | 665 | } |
666 | 666 | |
667 | 667 | if (rparam) |
668 | | free(rparam); |
| 668 | g_free (rparam); |
669 | 669 | if (rdata) |
670 | | free(rdata); |
| 670 | g_free (rdata); |
671 | 671 | |
672 | 672 | return(count > 0); |
673 | 673 | } |
… |
… |
BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, |
1745 | 1745 | *mode = SVAL(rdata,l1_attrFile); |
1746 | 1746 | } |
1747 | 1747 | |
1748 | | if (rdata) free(rdata); |
1749 | | if (rparam) free(rparam); |
| 1748 | if (rdata) g_free (rdata); |
| 1749 | if (rparam) g_free (rparam); |
1750 | 1750 | return True; |
1751 | 1751 | } |
1752 | 1752 | |
… |
… |
BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, |
1812 | 1812 | *ino = IVAL(rdata, 64); |
1813 | 1813 | } |
1814 | 1814 | |
1815 | | if (rdata) free(rdata); |
1816 | | if (rparam) free(rparam); |
| 1815 | if (rdata) g_free (rdata); |
| 1816 | if (rparam) g_free (rparam); |
1817 | 1817 | return True; |
1818 | 1818 | } |
1819 | 1819 | #endif /* 0 */ |
… |
… |
BOOL cli_qfileinfo(struct cli_state *cli, int fnum, |
1884 | 1884 | *ino = IVAL(rdata, 64); |
1885 | 1885 | } |
1886 | 1886 | |
1887 | | if (rdata) free(rdata); |
1888 | | if (rparam) free(rparam); |
| 1887 | if (rdata) g_free (rdata); |
| 1888 | if (rparam) g_free (rparam); |
1889 | 1889 | return True; |
1890 | 1890 | } |
1891 | 1891 | |
… |
… |
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, |
2141 | 2141 | |
2142 | 2142 | total_received += ff_searchcount; |
2143 | 2143 | |
2144 | | if (rdata) free(rdata); rdata = NULL; |
2145 | | if (rparam) free(rparam); rparam = NULL; |
| 2144 | if (rdata) g_free (rdata); rdata = NULL; |
| 2145 | if (rparam) g_free (rparam); rparam = NULL; |
2146 | 2146 | |
2147 | 2147 | DEBUG(3,("received %d entries (eos=%d resume=%d)\n", |
2148 | 2148 | ff_searchcount,ff_eos,ff_resume_key)); |
… |
… |
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute, |
2156 | 2156 | } |
2157 | 2157 | |
2158 | 2158 | /* free up the dirlist buffer */ |
2159 | | if (dirlist) free(dirlist); |
| 2159 | if (dirlist) g_free (dirlist); |
2160 | 2160 | return(total_received); |
2161 | 2161 | } |
2162 | 2162 | |
… |
… |
void cli_shutdown(struct cli_state *cli) |
2405 | 2405 | { |
2406 | 2406 | if (cli->outbuf) |
2407 | 2407 | { |
2408 | | free(cli->outbuf); |
| 2408 | g_free (cli->outbuf); |
2409 | 2409 | } |
2410 | 2410 | if (cli->inbuf) |
2411 | 2411 | { |
2412 | | free(cli->inbuf); |
| 2412 | g_free (cli->inbuf); |
2413 | 2413 | } |
2414 | 2414 | #ifdef WITH_SSL |
2415 | 2415 | if (cli->fd != -1) |