Changeset 454 for trunk/src/sh_unix.c


Ignore:
Timestamp:
Jun 29, 2014, 7:30:04 AM (10 years ago)
Author:
katerina
Message:

Fix for ticket #355 (use calloc instead of malloc).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_unix.c

    r436 r454  
    14751475
    14761476  /* printf("-> %2d: slots allocated\n", envlen); */
    1477   env1 = malloc (sizeof(char *) * envlen);      /* only once */
     1477  env1 = calloc(1,sizeof(char *) * envlen);      /* only once */
    14781478  if (env1 == NULL)
    14791479    {
     
    14861486  while (env0 != NULL && env0[envlen] != NULL) {
    14871487    len = strlen(env0[envlen]) + 1;
    1488     env1[envlen] = malloc (len); /* only once */
     1488    env1[envlen] = calloc(1,len); /* only once */
    14891489    if (env1[envlen] == NULL)
    14901490      {
     
    19101910    {
    19111911      len = strlen(str) + 1;
    1912       chroot_dir = malloc(strlen(str) + 1);  /* only once */
     1912      chroot_dir = calloc(1,strlen(str) + 1);  /* only once */
    19131913      if (!chroot_dir)
    19141914        {
     
    43494349              sh_error_handle (level, FIL__, __LINE__, stat_return,
    43504350                               MSG_FI_STAT,
    4351                                _("lstat"),
     4351                               _("lstat (link target)"),
    43524352                               sh_error_message (stat_return,errbuf, sizeof(errbuf)),
    43534353                               (long) euid,
     
    55685568  ptr = pthread_getspecific(gSigtrapVariables_key);
    55695569  if (ptr == NULL) {
    5570     ptr = malloc(sizeof(struct sh_sigtrap_variables));
     5570    ptr = calloc(1,sizeof(struct sh_sigtrap_variables));
    55715571    if (ptr == NULL) {
    55725572      return NULL;
Note: See TracChangeset for help on using the changeset viewer.