[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] pkl: handle failure of `asprintf'
From: |
Mohammad-Reza Nabipoor |
Subject: |
[PATCH] pkl: handle failure of `asprintf' |
Date: |
Sun, 25 Feb 2024 14:59:52 +0100 |
2024-02-25 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/pkl.c (pkl_resolve_module): Handle failure of `asprintf'.
---
Hi Jose.
I think ignoring silently the error of `asprintf' is OK here.
Because it's probably due to ENOMEM and when there's a memory problem
failing to load a module is acceptable.
Regards,
Mohammad-Reza
ChangeLog | 4 ++++
libpoke/pkl.c | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 74d9d54e..b2632461 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-02-25 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
+
+ * libpoke/pkl.c (pkl_resolve_module): Handle failure of `asprintf'.
+
2024-02-25 Jose E. Marchesi <jemarch@gnu.org>
* common/pk-utils.c (pk_str_concat): Assert that first argument
diff --git a/libpoke/pkl.c b/libpoke/pkl.c
index 2f67f757..9bcc0f11 100644
--- a/libpoke/pkl.c
+++ b/libpoke/pkl.c
@@ -789,7 +789,10 @@ pkl_resolve_module (pkl_compiler compiler,
e = strchrnul (e + 2, ':');
#endif
- asprintf (&full_filename, "%.*s/%s%s", (int) (e - s), s, module, ext);
+ if (asprintf (&full_filename, "%.*s/%s%s", (int)(e - s), s, module,
+ ext)
+ == -1)
+ break;
if (pk_file_readable (full_filename) == NULL)
break;
--
2.43.2
- [PATCH] pkl: handle failure of `asprintf',
Mohammad-Reza Nabipoor <=