Changeset 454 for trunk/src/slib.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/slib.c

    r412 r454  
    14931493      char          *  buffer;
    14941494      struct passwd *  tempres;
    1495       buffer = malloc(SH_PWBUF_SIZE);
     1495      buffer = calloc(1,SH_PWBUF_SIZE);
    14961496      SL_REQUIRE (buffer != NULL, _("buffer != NULL"));
    14971497      sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres);
     
    15421542      char          *  buffer;
    15431543      struct passwd *  tempres;
    1544       buffer = malloc(SH_PWBUF_SIZE);
     1544      buffer = calloc(1,SH_PWBUF_SIZE);
    15451545      SL_REQUIRE (buffer != NULL, _("buffer != NULL"));
    15461546      sh_getpwnam_r(user, &pwd, buffer, SH_PWBUF_SIZE, &tempres);
     
    17561756    }
    17571757
    1758   if ( (ofiles[fd] = (SL_OFILE *) malloc(sizeof(SL_OFILE))) == NULL)
     1758  if ( (ofiles[fd] = calloc(1,sizeof(SL_OFILE))) == NULL)
    17591759    {
    17601760      SL_IRETURN(SL_EMEM, _("sl_make_ticket"));
     
    17631763  len = sl_strlen(filename)+1;
    17641764
    1765   if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL)
     1765  if ( (ofiles[fd]->path = calloc(1,len) ) == NULL)
    17661766    {
    17671767      free (ofiles[fd]);
     
    20322032    }
    20332033
    2034   if ( (ofiles[fd] = (SL_OFILE *) malloc(sizeof(SL_OFILE))) == NULL)
     2034  if ( (ofiles[fd] = calloc(1,sizeof(SL_OFILE))) == NULL)
    20352035    {
    20362036      sl_close_fd(FIL__, __LINE__, fd);
     
    20402040  len = sl_strlen(filename)+1;
    20412041
    2042   if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL)
     2042  if ( (ofiles[fd]->path = calloc(1,len) ) == NULL)
    20432043    {
    20442044      free (ofiles[fd]);
Note: See TracChangeset for help on using the changeset viewer.