[1509] in Moira

home help back first fref pref prev next nref lref last post

fix coredump in add subnet

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Wed Apr 5 00:25:49 2000

Date: Wed, 5 Apr 2000 00:25:46 -0400
Message-Id: <200004050425.AAA19035@vorpal-blade.mit.edu>
To: moiradev@mit.edu
From: Jonathon Weiss <jweiss@MIT.EDU>


moira was coredumping in free when I tried to create a new network
(well, it coredumped under linux, but worked (probably for all the
wrong reasons) under solaris.)  This prevents the coredump, and I
*think* it is TRT, but I would appreciate it if someone could confirm
that when they review the patch.

	Jonathon


Index: utils.c
===================================================================
RCS file: /mit/moiradev/repository//moira/clients/moira/utils.c,v
retrieving revision 1.47
diff -c -r1.47 utils.c
*** utils.c	2000/03/15 22:44:06	1.47
--- utils.c	2000/04/05 04:06:03
***************
*** 865,871 ****
    if (ret == SUB_ERROR)
      return SUB_ERROR;
    addr.s_addr = inet_addr(value);
!   free(pointer);
    sprintf(buf, "%ld", ntohl(addr.s_addr));
    *pointer = strdup(buf);
    return SUB_NORMAL;
--- 865,871 ----
    if (ret == SUB_ERROR)
      return SUB_ERROR;
    addr.s_addr = inet_addr(value);
!   free(*pointer);
    sprintf(buf, "%ld", ntohl(addr.s_addr));
    *pointer = strdup(buf);
    return SUB_NORMAL;

home help back first fref pref prev next nref lref last post