Skip to content

Commit dd17692

Browse files
committed
lib/plist_find.c: avoid allocation
1 parent a634e82 commit dd17692

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/plist_find.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,11 @@ xbps_find_virtualpkg_in_conf(struct xbps_handle *xhp,
329329
continue;
330330
}
331331
} else {
332-
char *vpkgver = xbps_xasprintf("%s-999999_1", vpkg_conf);
332+
char vpkgver[XBPS_NAME_SIZE + sizeof("-999999_1")];
333+
snprintf(buf, sizeof(buf), "%s-999999_1", vpkg_conf);
333334
if (!xbps_pkgpattern_match(vpkgver, pkg)) {
334-
free(vpkgver);
335335
continue;
336336
}
337-
free(vpkgver);
338337
}
339338
} else if (xbps_pkg_version(pkg)) {
340339
// XXX: this is the old behaviour of only matching pkgname's,

0 commit comments

Comments
 (0)