INN commit: trunk (backends/actsync.c doc/pod/actsync.pod)

Julien ÉLIE julien at
Fri Aug 10 08:15:20 UTC 2007

En réponse à Russ Allbery :
> When we're limiting lengths, we use %.<length>s instead.

Thanks for the piece of advice.

> The code pattern that we're replacing already does allocate memory, so the
> frees already needed to be there.

Hm, there are not always there.
If for instance I look at frontends/feedone.c, I read:

main(ac, av) {
  char    *mesgid = NULL;
  mesgid[0] = '\0';
    case 'm':
        mesgid = optarg;
        mesgid = concat("<", optarg, ">", (char *) 0);
    case 'r':           /* Random Message-ID    */
            xasprintf(&mesgid, "<%ld@%ld>", (long) getpid(),
                     (long) time(NULL));
    if (mesgid == NULL) {
        mesgid = xstrdup(p);

    /* Does the server want this article? */
    fprintf(ToServer, "ihave %s\r\n", mesgid);

    /* Send the file over. */
    fprintf(ToServer, "%s %s\r\n", MESGIDHDR, mesgid);

And that's all.

Normally, mesgid will be automatically freed at the end of the function
but even so, should we explicitly call free()?

Julien ÉLIE

« -- Vous croyez qu'on s'est fait rouler, chef ?
  -- P'têt ben qu'oui, p'têt ben qu'non... » (Astérix) 

More information about the inn-workers mailing list