Skip to content

Commit fbee8aa

Browse files
committed
lib: fix memory leak in shlib check error messages
1 parent e6569be commit fbee8aa

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/transaction_check_shlibs.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,11 @@ check_shlibs(struct shlib_ctx *ctx, xbps_array_t pkgs)
198198
missing = xbps_xasprintf(
199199
"%s: broken, unresolvable shlib `%s'",
200200
pkgver, shlib);
201-
if (!xbps_array_add_cstring_nocopy(ctx->missing, missing))
201+
if (!xbps_array_add_cstring(ctx->missing, missing)) {
202+
free(missing);
202203
return xbps_error_oom();
204+
}
205+
free(missing);
203206
}
204207
}
205208

@@ -238,8 +241,11 @@ check_shlibs(struct shlib_ctx *ctx, xbps_array_t pkgs)
238241
missing = xbps_xasprintf(
239242
"%s: broken, unresolvable shlib `%s'", pkgver,
240243
shlib);
241-
if (!xbps_array_add_cstring_nocopy(ctx->missing, missing))
244+
if (!xbps_array_add_cstring(ctx->missing, missing)) {
245+
free(missing);
242246
return xbps_error_oom();
247+
}
248+
free(missing);
243249
}
244250
}
245251

0 commit comments

Comments
 (0)