From bb8fc03985d0ea59520da968d4b2cbbb923d741e Mon Sep 17 00:00:00 2001
From: Vit Rosin <vit_r@list.ru>
Date: Sat, 5 Dec 2009 23:36:18 +0000
Subject: [PATCH] fixing some memory alloc-calls
---
edit/syntax.c | 2 +-
src/complete.c | 2 +-
src/dir.c | 6 +++---
src/man2hlp.c | 6 +++---
src/mountlist.c | 30 +++++++++++++++---------------
src/user.c | 4 ++--
src/viewer/nroff.c | 2 +-
vfs/cpio.c | 6 +++---
vfs/mcfsutil.c | 3 +++
vfs/mcserv.c | 2 +-
vfs/samba/lib/charset.c | 2 +-
vfs/samba/lib/interface.c | 10 ++++++----
vfs/samba/lib/util.c | 6 +++---
vfs/samba/lib/util_str.c | 7 ++++---
vfs/samba/libsmb/clientgen.c | 6 +++---
vfs/samba/param/params.c | 2 +-
vfs/vfs.c | 2 +-
17 files changed, 52 insertions(+), 46 deletions(-)
diff --git a/edit/syntax.c b/edit/syntax.c
index 9055d6a..f28eef9 100644
a
|
b
|
edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file, |
1089 | 1089 | /* 1: just collecting a list of names of rule sets */ |
1090 | 1090 | /* Reallocate the list if required */ |
1091 | 1091 | if (count % NENTRIES == 0) { |
1092 | | if ((tmpnames = (char**) g_realloc (*pnames, (count + NENTRIES |
| 1092 | if ((tmpnames = (char**) g_try_realloc (*pnames, (count + NENTRIES |
1093 | 1093 | + 1) * sizeof (char*))) != NULL) |
1094 | 1094 | *pnames = tmpnames; |
1095 | 1095 | else |
diff --git a/src/complete.c b/src/complete.c
index a719b98..3f741b1 100644
a
|
b
|
static int insert_text (WInput *in, char *text, ssize_t size) |
873 | 873 | size = min (size, (ssize_t) strlen (text)) + start - end; |
874 | 874 | if (strlen (in->buffer) + size >= (size_t) in->current_max_size){ |
875 | 875 | /* Expand the buffer */ |
876 | | char *narea = g_realloc (in->buffer, in->current_max_size |
| 876 | char *narea = g_try_realloc (in->buffer, in->current_max_size |
877 | 877 | + size + in->field_width); |
878 | 878 | if (narea){ |
879 | 879 | in->buffer = narea; |
diff --git a/src/dir.c b/src/dir.c
index 74af764..c32db60 100644
a
|
b
|
set_zero_dir (dir_list *list) |
265 | 265 | { |
266 | 266 | /* Need to grow the *list? */ |
267 | 267 | if (list->size == 0) { |
268 | | list->list = g_realloc (list->list, sizeof (file_entry) * |
| 268 | list->list = g_try_realloc (list->list, sizeof (file_entry) * |
269 | 269 | (list->size + RESIZE_STEPS)); |
270 | 270 | if (list->list == NULL) |
271 | 271 | return FALSE; |
… |
… |
handle_dirent (dir_list *list, const char *filter, struct dirent *dp, |
328 | 328 | /* Need to grow the *list? */ |
329 | 329 | if (next_free == list->size) { |
330 | 330 | list->list = |
331 | | g_realloc (list->list, |
| 331 | g_try_realloc (list->list, |
332 | 332 | sizeof (file_entry) * (list->size + RESIZE_STEPS)); |
333 | 333 | if (!list->list) |
334 | 334 | return -1; |
… |
… |
handle_path (dir_list *list, const char *path, |
390 | 390 | |
391 | 391 | /* Need to grow the *list? */ |
392 | 392 | if (next_free == list->size){ |
393 | | list->list = g_realloc (list->list, sizeof (file_entry) * |
| 393 | list->list = g_try_realloc (list->list, sizeof (file_entry) * |
394 | 394 | (list->size + RESIZE_STEPS)); |
395 | 395 | if (!list->list) |
396 | 396 | return -1; |
diff --git a/src/man2hlp.c b/src/man2hlp.c
index aa95df6..6018f11 100644
a
|
b
|
handle_node (char *buffer, int is_sh) |
354 | 354 | if (!cnode) { |
355 | 355 | cnode = &nodes; |
356 | 356 | } else { |
357 | | cnode->next = malloc (sizeof (nodes)); |
| 357 | cnode->next = g_malloc (sizeof (nodes)); |
358 | 358 | cnode = cnode->next; |
359 | 359 | } |
360 | 360 | cnode->node = strdup (buffer); |
… |
… |
handle_link (char *buffer) |
649 | 649 | link_flag = 0; |
650 | 650 | /* Add to the linked list */ |
651 | 651 | if (current_link) { |
652 | | current_link->next = malloc (sizeof (links)); |
| 652 | current_link->next = g_malloc (sizeof (links)); |
653 | 653 | current_link = current_link->next; |
654 | 654 | current_link->next = NULL; |
655 | 655 | } else { |
… |
… |
main (int argc, char **argv) |
773 | 773 | if (!cnode) { |
774 | 774 | cnode = &nodes; |
775 | 775 | } else { |
776 | | cnode->next = malloc (sizeof (nodes)); |
| 776 | cnode->next = g_malloc (sizeof (nodes)); |
777 | 777 | cnode = cnode->next; |
778 | 778 | } |
779 | 779 | cnode->node = strdup (lc_node + 2); |
diff --git a/src/mountlist.c b/src/mountlist.c
index 847bf39..bf97da5 100644
a
|
b
|
read_filesystem_list (int need_fs_type, int all_fs) |
320 | 320 | (void) all_fs; |
321 | 321 | |
322 | 322 | /* Start the list off with a dummy entry. */ |
323 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 323 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
324 | 324 | me->me_next = NULL; |
325 | 325 | mlist = mtail = me; |
326 | 326 | |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
340 | 340 | || !strcmp (mnt->mnt_type, "auto"))) |
341 | 341 | continue; |
342 | 342 | |
343 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 343 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
344 | 344 | me->me_devname = strdup (mnt->mnt_fsname); |
345 | 345 | me->me_mountdir = strdup (mnt->mnt_dir); |
346 | 346 | me->me_type = strdup (mnt->mnt_type); |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
374 | 374 | if (entries < 0) |
375 | 375 | return NULL; |
376 | 376 | while (entries-- > 0) { |
377 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 377 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
378 | 378 | me->me_devname = strdup (fsp->f_mntfromname); |
379 | 379 | me->me_mountdir = strdup (fsp->f_mntonname); |
380 | 380 | #ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
402 | 402 | if (entries < 0) |
403 | 403 | return NULL; |
404 | 404 | for (; entries-- > 0; fsp++) { |
405 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 405 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
406 | 406 | me->me_devname = strdup (fsp->f_mntfromname); |
407 | 407 | me->me_mountdir = strdup (fsp->f_mntonname); |
408 | 408 | me->me_type = strdup (fsp->f_fstypename); |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
423 | 423 | |
424 | 424 | while ((val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY, |
425 | 425 | NULL)) > 0) { |
426 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 426 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
427 | 427 | me->me_devname = strdup (fsd.fd_req.devname); |
428 | 428 | me->me_mountdir = strdup (fsd.fd_req.path); |
429 | 429 | me->me_type = gt_names[fsd.fd_req.fstype]; |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
449 | 449 | return (NULL); |
450 | 450 | |
451 | 451 | bufsize = (1 + numsys) * sizeof (struct statfs); |
452 | | stats = (struct statfs *) malloc (bufsize); |
| 452 | stats = (struct statfs *) g_malloc (bufsize); |
453 | 453 | numsys = getfsstat (stats, bufsize, MNT_WAIT); |
454 | 454 | |
455 | 455 | if (numsys < 0) { |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
457 | 457 | return (NULL); |
458 | 458 | } |
459 | 459 | for (counter = 0; counter < numsys; counter++) { |
460 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 460 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
461 | 461 | me->me_devname = strdup (stats[counter].f_mntfromname); |
462 | 462 | me->me_mountdir = strdup (stats[counter].f_mntonname); |
463 | 463 | me->me_type = mnt_names[stats[counter].f_type]; |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
484 | 484 | return NULL; |
485 | 485 | |
486 | 486 | while (fread (&mnt, sizeof mnt, 1, fp) > 0) { |
487 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 487 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
488 | 488 | #ifdef GETFSTYP /* SVR3. */ |
489 | 489 | me->me_devname = strdup (mnt.mt_dev); |
490 | 490 | #else |
491 | | me->me_devname = malloc (strlen (mnt.mt_dev) + 6); |
| 491 | me->me_devname = g_malloc (strlen (mnt.mt_dev) + 6); |
492 | 492 | strcpy (me->me_devname, "/dev/"); |
493 | 493 | strcpy (me->me_devname + 5, mnt.mt_dev); |
494 | 494 | #endif |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
521 | 521 | { |
522 | 522 | struct mntent **mnttbl = getmnttbl (), **ent; |
523 | 523 | for (ent = mnttbl; *ent; ent++) { |
524 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 524 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
525 | 525 | me->me_devname = strdup ((*ent)->mt_resource); |
526 | 526 | me->me_mountdir = strdup ((*ent)->mt_directory); |
527 | 527 | me->me_type = strdup ((*ent)->mt_fstype); |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
548 | 548 | return NULL; |
549 | 549 | |
550 | 550 | while ((ret = getmntent (fp, &mnt)) == 0) { |
551 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 551 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
552 | 552 | me->me_devname = strdup (mnt.mnt_special); |
553 | 553 | me->me_mountdir = strdup (mnt.mnt_mountp); |
554 | 554 | me->me_type = strdup (mnt.mnt_fstype); |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
574 | 574 | |
575 | 575 | /* Ask how many bytes to allocate for the mounted filesystem info. */ |
576 | 576 | mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize); |
577 | | entries = malloc (bufsize); |
| 577 | entries = g_malloc (bufsize); |
578 | 578 | |
579 | 579 | /* Get the list of mounted filesystems. */ |
580 | 580 | mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries); |
… |
… |
read_filesystem_list (int need_fs_type, int all_fs) |
582 | 582 | for (thisent = entries; thisent < entries + bufsize; |
583 | 583 | thisent += vmp->vmt_length) { |
584 | 584 | vmp = (struct vmount *) thisent; |
585 | | me = (struct mount_entry *) malloc (sizeof (struct mount_entry)); |
| 585 | me = (struct mount_entry *) g_malloc (sizeof (struct mount_entry)); |
586 | 586 | if (vmp->vmt_flags & MNT_REMOTE) { |
587 | 587 | char *host, *path; |
588 | 588 | |
589 | 589 | /* Prepend the remote pathname. */ |
590 | 590 | host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off; |
591 | 591 | path = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; |
592 | | me->me_devname = malloc (strlen (host) + strlen (path) + 2); |
| 592 | me->me_devname = g_malloc (strlen (host) + strlen (path) + 2); |
593 | 593 | strcpy (me->me_devname, host); |
594 | 594 | strcat (me->me_devname, ":"); |
595 | 595 | strcat (me->me_devname, path); |
… |
… |
read_filesystem_list(int need_fs_type, int all_fs) |
644 | 644 | if (me->me_type) free(me->me_type); |
645 | 645 | } |
646 | 646 | else |
647 | | me = (struct mount_entry *)malloc(sizeof(struct mount_entry)); |
| 647 | me = (struct mount_entry *) g_malloc (sizeof(struct mount_entry)); |
648 | 648 | |
649 | 649 | if (!getcwd(dir, _POSIX_PATH_MAX)) return (NULL); |
650 | 650 | |
diff --git a/src/user.c b/src/user.c
index 10e1dbc..d04c1bd 100644
a
|
b
|
user_menu_cmd (WEdit *edit_widget) |
801 | 801 | char ** new_entries; |
802 | 802 | |
803 | 803 | menu_limit += MAX_ENTRIES; |
804 | | new_entries = g_realloc (entries, sizeof (new_entries[0]) * menu_limit); |
| 804 | new_entries = g_try_realloc (entries, sizeof (new_entries[0]) * menu_limit); |
805 | 805 | |
806 | | if (new_entries == 0) |
| 806 | if (new_entries == NULL) |
807 | 807 | break; |
808 | 808 | |
809 | 809 | entries = new_entries; |
diff --git a/src/viewer/nroff.c b/src/viewer/nroff.c
index 73d4668..56fdc03 100644
a
|
b
|
mcview_nroff_seq_new_num (mcview_t * view, off_t lc_index) |
226 | 226 | { |
227 | 227 | mcview_nroff_t *nroff; |
228 | 228 | |
229 | | nroff = g_malloc0 (sizeof (mcview_nroff_t)); |
| 229 | nroff = g_try_malloc0 (sizeof (mcview_nroff_t)); |
230 | 230 | if (nroff == NULL) |
231 | 231 | return NULL; |
232 | 232 | nroff->index = lc_index; |
diff --git a/vfs/cpio.c b/vfs/cpio.c
index 0af9cda..2bc3600 100644
a
|
b
|
static ssize_t cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *supe |
433 | 433 | super->name); |
434 | 434 | return STATUS_FAIL; |
435 | 435 | } |
436 | | name = g_malloc(u.buf.c_namesize); |
| 436 | name = g_malloc (u.buf.c_namesize); |
437 | 437 | if((len = mc_read(super->u.arch.fd, name, u.buf.c_namesize)) < u.buf.c_namesize) { |
438 | 438 | g_free(name); |
439 | 439 | return STATUS_EOF; |
… |
… |
static ssize_t cpio_read_oldc_head(struct vfs_class *me, struct vfs_s_super *sup |
491 | 491 | super->name); |
492 | 492 | return STATUS_FAIL; |
493 | 493 | } |
494 | | name = g_malloc(hd.c_namesize); |
| 494 | name = g_malloc (hd.c_namesize); |
495 | 495 | if((len = mc_read(super->u.arch.fd, name, hd.c_namesize)) == -1 || |
496 | 496 | (unsigned long) len < hd.c_namesize) { |
497 | 497 | g_free (name); |
… |
… |
cpio_read_crc_head (struct vfs_class *me, struct vfs_s_super *super) |
559 | 559 | return STATUS_FAIL; |
560 | 560 | } |
561 | 561 | |
562 | | name = g_malloc(hd.c_namesize); |
| 562 | name = g_malloc (hd.c_namesize); |
563 | 563 | len = mc_read (super->u.arch.fd, name, hd.c_namesize); |
564 | 564 | |
565 | 565 | if ((len == -1) || ((unsigned long) len < hd.c_namesize)) { |
diff --git a/vfs/mcfsutil.c b/vfs/mcfsutil.c
index d3c2e04..4e776ea 100644
a
|
b
|
rpc_get (int sock, ...) |
185 | 185 | |
186 | 186 | /* Don't use glib functions here - this code is used by mcserv */ |
187 | 187 | text = malloc (len + 1); |
| 188 | if (!text) |
| 189 | return 0; |
| 190 | |
188 | 191 | if (socket_read_block (sock, text, len) == 0) { |
189 | 192 | free (text); |
190 | 193 | va_end (ap); |
diff --git a/vfs/mcserv.c b/vfs/mcserv.c
index 5fedc55..877b5cb 100644
a
|
b
|
do_readdir (void) |
514 | 514 | rpc_send (msock, RPC_BLOCK, length, dirent->d_name, RPC_END); |
515 | 515 | fname_len = |
516 | 516 | strlen (mcfs_DIR.names[handle]) + strlen (dirent->d_name) + 2; |
517 | | fname = malloc (fname_len); |
| 517 | fname = g_malloc (fname_len); |
518 | 518 | snprintf (fname, fname_len, "%s/%s", mcfs_DIR.names[handle], |
519 | 519 | dirent->d_name); |
520 | 520 | n = lstat (fname, &st); |
diff --git a/vfs/samba/lib/charset.c b/vfs/samba/lib/charset.c
index 35f9126..8f70def 100644
a
|
b
|
multiple of 4.\n", codepage_file_name)); |
289 | 289 | } |
290 | 290 | |
291 | 291 | /* Allocate space for the code page file and read it all in. */ |
292 | | if((cp_p = (codepage_p)malloc( size + 4 )) == NULL) |
| 292 | if ((cp_p = (codepage_p) malloc ( size + 4 )) == NULL) |
293 | 293 | { |
294 | 294 | DEBUG(0,("load_client_codepage: malloc fail.\n")); |
295 | 295 | goto clean_and_exit; |
diff --git a/vfs/samba/lib/interface.c b/vfs/samba/lib/interface.c
index 5acad19..f8e8687 100644
a
|
b
|
static void interpret_interfaces(char *s, struct interface **interfaces, |
151 | 151 | if (i) continue; |
152 | 152 | } |
153 | 153 | |
154 | | iface = (struct interface *)malloc(sizeof(*iface)); |
155 | | if (!iface) return; |
| 154 | iface = (struct interface *) malloc (sizeof(*iface)); |
| 155 | if (!iface) |
| 156 | return; |
156 | 157 | |
157 | 158 | iface->ip = ip; |
158 | 159 | |
… |
… |
static void interpret_interfaces(char *s, struct interface **interfaces, |
181 | 182 | if (*interfaces) return; |
182 | 183 | |
183 | 184 | /* setup a default interface */ |
184 | | iface = (struct interface *)malloc(sizeof(*iface)); |
185 | | if (!iface) return; |
| 185 | iface = (struct interface *) malloc (sizeof(*iface)); |
| 186 | if (!iface) |
| 187 | return; |
186 | 188 | |
187 | 189 | iface->next = NULL; |
188 | 190 | |
diff --git a/vfs/samba/lib/util.c b/vfs/samba/lib/util.c
index da2fa83..e31f485 100644
a
|
b
|
void *Realloc(void *p,size_t size) |
1648 | 1648 | } |
1649 | 1649 | |
1650 | 1650 | if (!p) |
1651 | | ret = (void *)malloc(size); |
| 1651 | ret = (void *) malloc (size); |
1652 | 1652 | else |
1653 | | ret = (void *)realloc(p,size); |
| 1653 | ret = (void *) realloc (p,size); |
1654 | 1654 | |
1655 | 1655 | #ifdef MEM_MAN |
1656 | 1656 | { |
… |
… |
void set_namearray(name_compare_entry **ppname_array, char *namelist) |
2477 | 2477 | if(num_entries == 0) |
2478 | 2478 | return; |
2479 | 2479 | |
2480 | | if(( (*ppname_array) = (name_compare_entry *)malloc( |
| 2480 | if(( (*ppname_array) = (name_compare_entry *) g_malloc ( |
2481 | 2481 | (num_entries + 1) * sizeof(name_compare_entry))) == NULL) |
2482 | 2482 | { |
2483 | 2483 | DEBUG(0,("set_namearray: malloc fail\n")); |
diff --git a/vfs/samba/lib/util_str.c b/vfs/samba/lib/util_str.c
index 74b5303..c241dfd 100644
a
|
b
|
char **toktocliplist(int *ctok, char *sep) |
101 | 101 | *ctok=ictok; |
102 | 102 | s=last_ptr; |
103 | 103 | |
104 | | if (!(ret=iret=malloc(ictok*sizeof(char *)))) return NULL; |
| 104 | if (!(ret = iret = g_malloc (ictok * sizeof(char *)))) |
| 105 | return NULL; |
105 | 106 | |
106 | 107 | while(ictok--) { |
107 | 108 | *iret++=s; |
… |
… |
BOOL string_init(char **dest,const char *src) |
951 | 952 | if (l == 0) |
952 | 953 | { |
953 | 954 | if (!null_string) { |
954 | | if((null_string = (char *)malloc(1)) == NULL) { |
| 955 | if ((null_string = (char *) malloc (1)) == NULL) { |
955 | 956 | DEBUG(0,("string_init: malloc fail for null_string.\n")); |
956 | 957 | return False; |
957 | 958 | } |
… |
… |
BOOL string_init(char **dest,const char *src) |
961 | 962 | } |
962 | 963 | else |
963 | 964 | { |
964 | | (*dest) = (char *)malloc(l+1); |
| 965 | (*dest) = (char *) g_malloc (l+1); |
965 | 966 | if ((*dest) == NULL) { |
966 | 967 | DEBUG(0,("Out of memory in string_init\n")); |
967 | 968 | return False; |
diff --git a/vfs/samba/libsmb/clientgen.c b/vfs/samba/libsmb/clientgen.c
index 0dd0710..05cceb2 100644
a
|
b
|
initialise a client structure |
2364 | 2364 | struct cli_state *cli_initialise(struct cli_state *cli) |
2365 | 2365 | { |
2366 | 2366 | if (!cli) { |
2367 | | cli = (struct cli_state *)malloc(sizeof(*cli)); |
| 2367 | cli = (struct cli_state *) malloc (sizeof(*cli)); |
2368 | 2368 | if (!cli) |
2369 | 2369 | return NULL; |
2370 | 2370 | ZERO_STRUCTP(cli); |
… |
… |
struct cli_state *cli_initialise(struct cli_state *cli) |
2386 | 2386 | cli->timeout = 20000; /* Timeout is in milliseconds. */ |
2387 | 2387 | cli->bufsize = CLI_BUFFER_SIZE+4; |
2388 | 2388 | cli->max_xmit = cli->bufsize; |
2389 | | cli->outbuf = (char *)malloc(cli->bufsize); |
2390 | | cli->inbuf = (char *)malloc(cli->bufsize); |
| 2389 | cli->outbuf = (char *) malloc (cli->bufsize); |
| 2390 | cli->inbuf = (char *) malloc (cli->bufsize); |
2391 | 2391 | if (!cli->outbuf || !cli->inbuf) |
2392 | 2392 | { |
2393 | 2393 | return False; |
diff --git a/vfs/samba/param/params.c b/vfs/samba/param/params.c
index 46bbfc3..49c6a4c 100644
a
|
b
|
BOOL pm_process( const char *FileName, |
544 | 544 | else /* If we don't have a buffer */ |
545 | 545 | { /* allocate one, then parse, */ |
546 | 546 | bSize = BUFR_INC; /* then free. */ |
547 | | bufr = (char *)malloc( bSize ); |
| 547 | bufr = (char *) malloc ( bSize ); |
548 | 548 | if( NULL == bufr ) |
549 | 549 | { |
550 | 550 | DEBUG(0,("%s memory allocation failure.\n", func)); |
diff --git a/vfs/vfs.c b/vfs/vfs.c
index f8eb7a1..c489058 100644
a
|
b
|
mc_readdir (DIR *dirp) |
795 | 795 | * structures, holding dirent size. But we don't use it in libc infrastructure. |
796 | 796 | * TODO: to make simpler homemade dirent-alike structure. |
797 | 797 | */ |
798 | | mc_readdir_result = (struct dirent *)malloc(sizeof(struct dirent) + NAME_MAX + 1); |
| 798 | mc_readdir_result = (struct dirent *) g_malloc (sizeof(struct dirent) + NAME_MAX + 1); |
799 | 799 | } |
800 | 800 | |
801 | 801 | if (!dirp) { |