Skip to content
Browse files

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.
  • Loading branch information...
1 parent 0bf440d commit 1772539a42ab91ee3d03a6b86df8df959853d1dc @davisp committed Jun 6, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 c_src/jiffy.c
3 c_src/jiffy.c
@@ -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);

0 comments on commit 1772539

Please sign in to comment.
Something went wrong with that request. Please try again.