Skip to content

Commit

Permalink
Be paranoid about the values sent to upgrade
Browse files Browse the repository at this point in the history
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
davisp committed Jun 7, 2012
1 parent 0bf440d commit 1772539
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion c_src/jiffy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 1772539

Please sign in to comment.