OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Mike (mikejeke.fdns.net)
Date: Tue Feb 05 2002 - 19:38:44 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    you didn't malloc the pointer..

    see embedded:

    Marc Xander Makkes wrote:
    >
    > I have this little code;
    >
    > +----
    >
    > #include <stdio.h>
    >
    > struct point { int x; int y;};
    > int main()
    > {
    > struct point *p;

      /* Allocate some room the structure */
      p = (struct point *)malloc (sizeof(struct point));

    > p->y = 13;
    > printf("%d\n", p->y);
    > }
    >
    > ----+
    >
    > it compiles and runs ok on solaris, and it compiles ok on openbsd but
    > when i run it, it directly core dumpes. Is there something i forgot to
    > read or is it the 13?:)
    >
    > The code is compiled on 2 differend OpenBSD 3.0 machines, one with GENERIC
    > and one modified, both i386.
    >
    > any clues ?
    >
    > Kind regards,
    >
    > MX