[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/14] test: Use g_strndup instead of plain strndup
From: |
Laurent Vivier |
Subject: |
[Qemu-devel] [PULL 01/14] test: Use g_strndup instead of plain strndup |
Date: |
Wed, 21 Aug 2019 13:19:34 +0200 |
From: "address@hidden" <address@hidden>
Due to memory management rules. See HACKING.
Signed-off-by: Tony Nguyen <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
tests/check-qjson.c | 2 +-
tests/migration/stress.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index fa2afccb0a24..07a773e6530b 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -767,7 +767,7 @@ static void utf8_string(void)
if (*end == ' ') {
end++;
}
- in = strndup(tail, end - tail);
+ in = g_strndup(tail, end - tail);
str = from_json_str(in, j, NULL);
g_assert(!str);
g_free(in);
diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index 49a03aab7b83..d9aa4afe928b 100644
--- a/tests/migration/stress.c
+++ b/tests/migration/stress.c
@@ -104,9 +104,9 @@ static int get_command_arg_str(const char *name,
}
if (end)
- *val = strndup(start, end - start);
+ *val = g_strndup(start, end - start);
else
- *val = strdup(start);
+ *val = g_strdup(start);
return 1;
}
@@ -126,10 +126,10 @@ static int get_command_arg_ull(const char *name,
if (errno || *end) {
fprintf(stderr, "%s (%05d): ERROR: cannot parse %s value %s\n",
argv0, gettid(), name, valstr);
- free(valstr);
+ g_free(valstr);
return -1;
}
- free(valstr);
+ g_free(valstr);
return 0;
}
--
2.21.0
- [Qemu-devel] [PULL 00/14] Trivial branch patches, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 05/14] .gitignore: ignore some vhost-user* related files, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 01/14] test: Use g_strndup instead of plain strndup,
Laurent Vivier <=
- [Qemu-devel] [PULL 13/14] hw/display/sm501: Remove unused include, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 07/14] json: Move switch 'fall through' comment to correct place, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 14/14] hw/display: Compile various display devices as common object, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 08/14] hw/dma/omap_dma: Move switch 'fall through' comment to correct place, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 02/14] misc: fix naming scheme of compatiblity arrays, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 11/14] vl: Rewrite a fall through comment, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 03/14] configure: remove obsoleted $sparc_cpu variable, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 06/14] hw/net/e1000: Fix erroneous comment, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 12/14] spapr_events: Rewrite a fall through comment, Laurent Vivier, 2019/08/21
- [Qemu-devel] [PULL 10/14] target/ppc: Rewrite a fall through comment, Laurent Vivier, 2019/08/21