aboutsummaryrefslogtreecommitdiff
path: root/tests/migration
diff options
context:
space:
mode:
authortony.nguyen@bt.com <tony.nguyen@bt.com>2019-06-08 05:25:52 +0000
committerLaurent Vivier <laurent@vivier.eu>2019-08-21 10:27:13 +0200
commit348fbd5816cab30d38d7a3727a4b83404797128a (patch)
tree13f4a9c42f28f95e7a87d2e0da64f246b278b5b5 /tests/migration
parent17dc57990320edaad52ac9ea808be9719c91cea6 (diff)
downloadqemu-348fbd5816cab30d38d7a3727a4b83404797128a.zip
qemu-348fbd5816cab30d38d7a3727a4b83404797128a.tar.gz
qemu-348fbd5816cab30d38d7a3727a4b83404797128a.tar.bz2
test: Use g_strndup instead of plain strndup
Due to memory management rules. See HACKING. Signed-off-by: Tony Nguyen <tony.nguyen@bt.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <dce313b46d294ada8826d34609a3447e@tpw09926dag18e.domain1.systemhost.net> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'tests/migration')
-rw-r--r--tests/migration/stress.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/migration/stress.c b/tests/migration/stress.c
index 49a03aa..d9aa4af 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;
}