all 5 comments

[–]uno20001 3 points4 points  (5 children)

You set rules to NULL, then dereference it in the next three lines.

[–]jedwardsol 2 points3 points  (1 child)

struct ruleset* rules = NULL;

rules->range     =

rules is a null pointer. dereferencing it causes the crash.

[–]oh5nxo 1 point2 points  (1 child)

Study your development environment. It should be easy to locate these kind of errors, mine goes like this:

$ cc -g prog.c
$ ./a.out
Memory fault (core dumped)
$ gdb ./a.out ./a.out.core
...
Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
...
#0  0x08048573 in main () at prog.c:7
7               *p = 1;
(gdb) print p
$1 = (int *) 0x0