Skip to content

Commit

Permalink
Using Safefree. Thanks to Leont for GH#15
Browse files Browse the repository at this point in the history
  • Loading branch information
david-dick committed Jan 13, 2025
1 parent f27ca7b commit be528e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions URandom.xs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ crypt_urandom_getrandom(length)
#endif
#endif
if (result != length) {
Safefree(data);
croak("Only read %d bytes from getrandom:%s", result, strerror(errno));
}
data[result] = '\0';
RETVAL = newSVpv(data, result);
Safefree(data);
OUTPUT:
RETVAL

0 comments on commit be528e2

Please sign in to comment.