Skip to content

Commit

Permalink
fix potential double-free when catching errors in R's lapack ref #41
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Mar 17, 2023
1 parent c82ce5d commit 1d2e3b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cmfrec
Type: Package
Title: Collective Matrix Factorization for Recommender Systems
Version: 3.5.1
Version: 3.5.1-1
Authors@R: c(
person(given="David", family="Cortes", role=c("aut", "cre", "cph"),
email="[email protected]"),
Expand Down
10 changes: 3 additions & 7 deletions src/offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -1965,13 +1965,11 @@ int_t fit_offsets_als
#else
void *lst_pointers[] = {MatTrans, U_plus_bias, sv,
buffer_real_t, buffer_iwork,
(U_plus_bias != U)? U_plus_bias : NULL,
(I_plus_bias != II)? I_plus_bias : NULL,
GELSD_free_inputs? A : NULL,
GELSD_free_inputs? B : NULL,
GELSD_free_inputs? X : NULL,
GELSD_free_inputs? Xfull : NULL};
PointersToFree ptrs_free = {lst_pointers, (size_t)11};
PointersToFree ptrs_free = {lst_pointers, (size_t)9};
Args_to_GELSD args_GELSD = {&m, &p_plus_bias, &k,
U_plus_bias, &m, MatTrans, &ldb,
sv, &threshold_svd, &rank,
Expand Down Expand Up @@ -2066,15 +2064,13 @@ int_t fit_offsets_als
sv, &threshold_svd, &rank,
&temp, &minus_one, &sz_iwork, &ignore);
#else
void *lst_pointers[] = {MatTrans, U_plus_bias, sv,
void *lst_pointers[] = {MatTrans, I_plus_bias, sv,
buffer_real_t, buffer_iwork,
(U_plus_bias != U)? U_plus_bias : NULL,
(I_plus_bias != II)? I_plus_bias : NULL,
GELSD_free_inputs? A : NULL,
GELSD_free_inputs? B : NULL,
GELSD_free_inputs? X : NULL,
GELSD_free_inputs? Xfull : NULL};
PointersToFree ptrs_free = {lst_pointers, (size_t)11};
PointersToFree ptrs_free = {lst_pointers, (size_t)9};
Args_to_GELSD args_GELSD = {&n, &q_plus_bias, &k,
I_plus_bias, &n, MatTrans, &ldb,
sv, &threshold_svd, &rank,
Expand Down

0 comments on commit 1d2e3b7

Please sign in to comment.