]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tools/virtiofsd/fuse_opt.c
tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc
[mirror_qemu.git] / tools / virtiofsd / fuse_opt.c
index f0ab8d22f4db973e49b48c9b54b8d58c8dadf80f..9d371448e94bd0813dbc9bdfeee241cb67bf9410 100644 (file)
@@ -272,7 +272,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx,
     }
 
     param = ctx->argv[ctx->argctr];
-    newarg = malloc(sep + strlen(param) + 1);
+    newarg = g_try_malloc(sep + strlen(param) + 1);
     if (!newarg) {
         return alloc_failed();
     }
@@ -280,7 +280,7 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx,
     memcpy(newarg, arg, sep);
     strcpy(newarg + sep, param);
     res = process_opt(ctx, opt, sep, newarg, iso);
-    free(newarg);
+    g_free(newarg);
 
     return res;
 }