From: jsg Date: Sun, 26 Mar 2023 09:34:06 +0000 (+0000) Subject: fix a memory leak X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=815bac8a67e03de0a8093730371c953de051b482;p=openbsd fix a memory leak feedback kettenis@ ok miod@ --- diff --git a/sys/arch/arm64/dev/apldc.c b/sys/arch/arm64/dev/apldc.c index 678191dc4cd..454099d2515 100644 --- a/sys/arch/arm64/dev/apldc.c +++ b/sys/arch/arm64/dev/apldc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apldc.c,v 1.5 2023/03/05 14:45:07 patrick Exp $ */ +/* $OpenBSD: apldc.c,v 1.6 2023/03/26 09:34:06 jsg Exp $ */ /* * Copyright (c) 2022 Mark Kettenis * @@ -995,15 +995,17 @@ apldchidev_attachhook(struct device *self) len = OF_getproplen(node, "firmware-name"); if (len <= 0) return; - firmware_name = malloc(len, M_DEVBUF, M_WAITOK); + firmware_name = malloc(len, M_TEMP, M_WAITOK); OF_getprop(node, "firmware-name", firmware_name, len); error = loadfirmware(firmware_name, &ucode, &ucode_size); if (error) { printf("%s: error %d, could not read firmware %s\n", sc->sc_dev.dv_xname, error, firmware_name); + free(firmware_name, M_TEMP, len); return; } + free(firmware_name, M_TEMP, len); hdr = (struct mtp_fwhdr *)ucode; if (sizeof(hdr) > ucode_size ||