Browse Source

Be paranoid about the values sent to upgrade

The docs aren't entirely clear on the order of calls for upgrades so
this is mostly just in case old_priv ever happens to not be what load
returned in priv.
pull/29/head 0.5.1
Paul J. Davis 13 years ago
parent
commit
1772539a42
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      c_src/jiffy.c

+ 2
- 1
c_src/jiffy.c View File

@ -42,7 +42,8 @@ reload(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
static int
upgrade(ErlNifEnv* env, void** priv, void** old_priv, ERL_NIF_TERM info)
{
enif_free(*old_priv);
if(*old_priv != NULL)
enif_free(*old_priv);
return load(env, priv, info);
}

Loading…
Cancel
Save