Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229268/?format=api
{ "id": 2229268, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229268/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427223928.2742270-1-luc.fast2004@gmail.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260427223928.2742270-1-luc.fast2004@gmail.com>", "date": "2026-04-27T22:39:28", "name": "hw/audio/fmopl.c: Convert malloc, free to g_malloc0, g_new and g_free", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b5bc2932311a7cea94f2252824a405c06810a94a", "submitter": { "id": 93266, "url": "http://patchwork.ozlabs.org/api/1.1/people/93266/?format=api", "name": "Lucas Cardoso", "email": "luc.fast2004@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427223928.2742270-1-luc.fast2004@gmail.com/mbox/", "series": [ { "id": 501745, "url": "http://patchwork.ozlabs.org/api/1.1/series/501745/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501745", "date": "2026-04-27T22:39:28", "name": "hw/audio/fmopl.c: Convert malloc, free to g_malloc0, g_new and g_free", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501745/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229268/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229268/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=qDkOV5+e;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4Kx45PLgz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 09:47:19 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHVf0-0004NK-SO; Mon, 27 Apr 2026 19:46:42 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <luc.fast2004@gmail.com>)\n id 1wHUcE-0003GB-3g\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 18:39:46 -0400", "from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <luc.fast2004@gmail.com>)\n id 1wHUcB-0003qW-Pe\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 18:39:45 -0400", "by mail-yw1-x1129.google.com with SMTP id\n 00721157ae682-7986e538decso107286227b3.1\n for <qemu-devel@nongnu.org>; Mon, 27 Apr 2026 15:39:40 -0700 (PDT)", "from lucas-Vivobook-S14 ([2804:14d:8084:8f4b:f361:41cb:cdbc:1fa5])\n by smtp.gmail.com with ESMTPSA id\n 00721157ae682-7bcf0d46735sm3890237b3.49.2026.04.27.15.39.37\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 27 Apr 2026 15:39:38 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1777329579; x=1777934379; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=QR/8CAv1yHVvho2HJOnICwYccKH8BL0Tjx0osxNOLnc=;\n b=qDkOV5+eSRanDfH7+5qntBRptFwQQPMkWzWyJvmxyJBxl7q1regxb1TLKwWsmbIJy/\n /iI9EJ42aOnCxhF4vTMLsO46n2cCRFGRcDaQiuX5LU9YVx270nZDZGVWW11SfkYIQwfh\n QJGgssr1i8p0/eQ/wVwCl/VAM4GwUBIZo/rktCKcNCV2MmkWNcruAt+/WNF5Dgrg2e/r\n wzcaAWcBxe/HiJ6lwdQpJvKxyhCE99rtHvi47inWi05ihbG7HLcpmx9QIHSLiV8XhZTG\n 2iYCSrPH0CyQhKRwePRT1mJLtC3+2gkwEsWD+oyvRr3J8WJb+zTMBdy4KdK+DvHbTyI3\n 1z8w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777329579; x=1777934379;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=QR/8CAv1yHVvho2HJOnICwYccKH8BL0Tjx0osxNOLnc=;\n b=M0YP7KGY6E/45RiaTFP0jKUE/1d5JiOSB8AgN/l8jX2xxCK4y4a7N1rGiWYckkHcj9\n u4o+5RlOGxA0q+RqjGrynyPSC11SRWSvIM09KG2KCx3otgbMlvXH2a/JXbrcN+LsUoNL\n 7xIbKhIePgoijXSwoM3BBRVT6oe4oitLNdWIuCFZ0HAY58HpXTtwiM1YTgOQihMl+Hry\n TTWyrhyETh6VjkJzBjZcE3HNPL3wZKWOOkWanzkTAGSe/CU972XmIPF/Jb80jvMbXinc\n nwXHmw8qRFgLhD5BKDgnb0yUBLYKC8/6ymwxx7DEErDnBIYCPwUuc0chkSU2JRl+HJqJ\n ga7w==", "X-Gm-Message-State": "AOJu0Yx2aVFsBTS7g5/VOO2WxqgDPJMSHM6XZmMgdLDHiopOdILDD6mX\n YwPyVuovEToV8qgA8jJ//GgmRvmvEDdQ6ARl1wO1U//AHDtA2N4UkT9DNo6r1iG6", "X-Gm-Gg": "AeBDiestqvAHIReCceY4JXsDmgtEnckDka+5/AvcTvxD+U9OlYb8ZL754i50LghLvhy\n HUqw+AFQDcnWc06DTynbV0edp51gpOPYuHwDSEMQhYqP3aJ6IiDXk3QoKxs42GJQjUWxjyKtr/9\n 5RReNwlG/ZvG3QP54xORiUaF3j4r6JxtXryxsrT5bu1AGlWSUY3WW+zJLtSNm9FbyH/M5A3Ha7m\n DZGAH0ithRtrXWehTCnIRNXbNFcm9SR5OULVmrt3vpdquw0ZpkVnqAy0h+TJiKGHZsGYIe42YNS\n Axbvw6xszViRCDhh23a37WY+rmUQu/Ezrc75rGLFqwkAzLvsLA8SH3QHTmAIb/lmTbTPGKt0SMA\n GKazheuKKPtsUYPWl55Sj5psL+XZslesdUVsqWzzcqC0dD7clSTLyfE1SziM8tYzGdhvQOSbjZj\n APTeQ33fQ2kZY7qTpGXqDt4djGSiILIzDKCrHNLi9E1CWxhs4hkA==", "X-Received": "by 2002:a05:690c:3586:b0:7bb:eaf:5101 with SMTP id\n 00721157ae682-7bcf51f5d10mr6026207b3.16.1777329579070;\n Mon, 27 Apr 2026 15:39:39 -0700 (PDT)", "From": "Lucas Cardoso <luc.fast2004@gmail.com>", "To": "qemu-devel@nongnu.org", "Cc": "kraxel@redhat.com, qemu-trivial@nongnu.org,\n Lucas Cardoso <luc.fast2004@gmail.com>", "Subject": "[PATCH] hw/audio/fmopl.c: Convert malloc, free to g_malloc0,\n g_new and g_free", "Date": "Mon, 27 Apr 2026 19:39:28 -0300", "Message-ID": "<20260427223928.2742270-1-luc.fast2004@gmail.com>", "X-Mailer": "git-send-email 2.51.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1129;\n envelope-from=luc.fast2004@gmail.com; helo=mail-yw1-x1129.google.com", "X-Spam_score_int": "-17", "X-Spam_score": "-1.8", "X-Spam_bar": "-", "X-Spam_report": "(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no", "X-Spam_action": "no action", "X-Mailman-Approved-At": "Mon, 27 Apr 2026 19:46:40 -0400", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "In accordance with QEMU's coding style guidelines, replace raw memory\nallocation functions (malloc/free) with their GLib equivalents\n(g_new/g_malloc0/g_free).\n\nAlso removes the old generic error-handling code from\nOPLOpenTable(), since the Glib functions abort the program automatically\nif memory is exhausted.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/work_items/1798\nSigned-off-by: Lucas Cardoso <luc.fast2004@gmail.com>\n---\n hw/audio/fmopl.c | 41 +++++++++++------------------------------\n 1 file changed, 11 insertions(+), 30 deletions(-)", "diff": "diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c\nindex a63ad0f04d..aeefc4c9fe 100644\n--- a/hw/audio/fmopl.c\n+++ b/hw/audio/fmopl.c\n@@ -607,26 +607,10 @@ static int OPLOpenTable( void )\n \tdouble pom;\n \n \t/* allocate dynamic tables */\n-\tif( (TL_TABLE = malloc(TL_MAX*2*sizeof(int32_t))) == NULL)\n-\t\treturn 0;\n-\tif( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(int32_t *))) == NULL)\n-\t{\n-\t\tfree(TL_TABLE);\n-\t\treturn 0;\n-\t}\n-\tif( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(int32_t))) == NULL)\n-\t{\n-\t\tfree(TL_TABLE);\n-\t\tfree(SIN_TABLE);\n-\t\treturn 0;\n-\t}\n-\tif( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(int32_t))) == NULL)\n-\t{\n-\t\tfree(TL_TABLE);\n-\t\tfree(SIN_TABLE);\n-\t\tfree(AMS_TABLE);\n-\t\treturn 0;\n-\t}\n+ TL_TABLE = g_new(int32_t, TL_MAX * 2);\n+ SIN_TABLE = g_new(int32_t *, SIN_ENT * 4);\n+ AMS_TABLE = g_new(int32_t, AMS_ENT * 2);\n+ VIB_TABLE = g_new(int32_t, VIB_ENT * 2);\n ENV_CURVE = g_new(int32_t, 2 * EG_ENT + 1);\n \t/* make total level table */\n \tfor (t = 0;t < EG_ENT-1 ;t++){\n@@ -696,10 +680,10 @@ static int OPLOpenTable( void )\n static void OPLCloseTable( void )\n {\n g_free(ENV_CURVE);\n-\tfree(TL_TABLE);\n-\tfree(SIN_TABLE);\n-\tfree(AMS_TABLE);\n-\tfree(VIB_TABLE);\n+ g_free(TL_TABLE);\n+ g_free(SIN_TABLE);\n+ g_free(AMS_TABLE);\n+ g_free(VIB_TABLE);\n }\n \n /* CSM Key Control */\n@@ -1081,11 +1065,8 @@ FM_OPL *OPLCreate(int clock, int rate)\n \t/* allocate OPL state space */\n \tstate_size = sizeof(FM_OPL);\n \tstate_size += sizeof(OPL_CH)*max_ch;\n-\t/* allocate memory block */\n-\tptr = malloc(state_size);\n-\tif(ptr==NULL) return NULL;\n-\t/* clear */\n-\tmemset(ptr,0,state_size);\n+ /* allocate memory block and zero-initialize */\n+ ptr = g_malloc0(state_size);\n \tOPL = (FM_OPL *)ptr; ptr+=sizeof(FM_OPL);\n \tOPL->P_CH = (OPL_CH *)ptr; ptr+=sizeof(OPL_CH)*max_ch;\n \t/* set channel state pointer */\n@@ -1128,7 +1109,7 @@ void OPLDestroy(FM_OPL *OPL)\n \t}\n #endif\n \tOPL_UnLockTable();\n-\tfree(OPL);\n+ g_free(OPL);\n }\n \n /* ---------- Option handlers ---------- */\n", "prefixes": [] }