メモリの確保のやり方か、データのやり方がおかしいので、
実行時にメモリーリークを起こしているみたいなのですがどこが
おかしいのでしょうか。
/* factorization.c 因数分解する */
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <math.h>
/* 求める因数の下限 */
#define FACTOR_LOWER_LIMIT (2)
typedef struct Factor_tag Factor;
struct Factor_tag
{
int value;
Factor * next; /* 末端はNULL */
};
typedef struct Header_tag
{
int size; /* Factorのリストのサイズ */
Factor * head;
} Header;

static Factor * addition(int value, Factor * current, Factor ** head);

void factorization(const int number, Header * const pheader)
{
Factor * head = NULL, * current = NULL;
int loop, dest;

{
int tmp;
tmp = ceil(sqrt(number));
dest = (tmp > FACTOR_LOWER_LIMIT) ? tmp : FACTOR_LOWER_LIMIT;
}
if(number == dest * dest)
{
current = addition(dest, current, &head);
++pheader->size;
}
for(loop = FACTOR_LOWER_LIMIT; loop != dest; ++loop)
{
if(number % loop == 0)
{
current = addition(loop, current, &head);
current = addition(number / loop, current, &head);
pheader->size += 2;
}
}
pheader->head = head;
#ifdef DEBUG
printf("prcessing %d is over.\n", number);
#endif /* DEBUG */
}