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

    r435 r454  
    6464#define ulong unsigned long
    6565
    66 /*
    67 extern void *malloc(size_t size);
    68 extern void free();
    69 */
    70 
    7166char *last_string    = NULL;
    7267char *big_end_string = NULL;
     
    232227    dgs_alloc += alloclen;
    233228#endif
    234     digit_ptr = (DIGIT *) malloc(alloclen * sizeof(DIGIT));
     229    digit_ptr = calloc(alloclen, sizeof(DIGIT));
    235230    if (digit_ptr == NULL)
    236231    {
     
    625620    big_set_long((long)1, &big_one);
    626621    length_last_string = 10;
    627     if ((last_string = malloc(length_last_string)) == NULL)
     622    if ((last_string = calloc(1,length_last_string)) == NULL)
    628623    {
    629624        big_errno = BIG_MEMERR;
     
    955950        if (last_string != NULL)
    956951          free(last_string);
    957         if ((last_string = malloc(str_length)) == NULL)
     952        if ((last_string = calloc(1,str_length)) == NULL)
    958953        {
    959954            big_errno = BIG_MEMERR;
Note: See TracChangeset for help on using the changeset viewer.