diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2017-10-11 20:36:41 -0700 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2017-10-13 18:09:28 -0700 |
commit | b27acd687800499324381648036edd098c996524 (patch) | |
tree | 3197172546126fff94e8918ad2244f0788f60ee7 /src/location-manual.c | |
parent | Move module struct definitions to separate files (diff) | |
download | redshift-ng-b27acd687800499324381648036edd098c996524.tar.gz redshift-ng-b27acd687800499324381648036edd098c996524.tar.bz2 redshift-ng-b27acd687800499324381648036edd098c996524.tar.xz |
Allocate module data in init functions
Diffstat (limited to 'src/location-manual.c')
-rw-r--r-- | src/location-manual.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/location-manual.c b/src/location-manual.c index d7ba37a..f459b27 100644 --- a/src/location-manual.c +++ b/src/location-manual.c @@ -34,10 +34,14 @@ static int -location_manual_init(location_manual_state_t *state) +location_manual_init(location_manual_state_t **state) { - state->loc.lat = NAN; - state->loc.lon = NAN; + *state = malloc(sizeof(location_manual_state_t)); + if (*state == NULL) return -1; + + location_manual_state_t *s = *state; + s->loc.lat = NAN; + s->loc.lon = NAN; return 0; } @@ -57,6 +61,7 @@ location_manual_start(location_manual_state_t *state) static void location_manual_free(location_manual_state_t *state) { + free(state); } static void |