From 11af232b19155c76002b5ca1f2b0e89d75699d3a Mon Sep 17 00:00:00 2001 From: graham.gower Date: Tue, 03 Nov 2009 22:14:59 -0500 Subject: s/strdup/xstrdup/ - check memory allocations for failure. git-svn-id: http://opkg.googlecode.com/svn/trunk@255 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg/args.c') diff --git a/libopkg/args.c b/libopkg/args.c index bbe2e4d..b7aafcd 100644 --- a/libopkg/args.c +++ b/libopkg/args.c @@ -25,6 +25,7 @@ #include "config.h" #include "args.h" #include "sprintf_alloc.h" +#include "libbb/libbb.h" static void print_version(void); @@ -163,23 +164,23 @@ int args_parse(args_t *args, int argc, char *argv[]) args->query_all = 1; break; case 'd': - args->dest = strdup (optarg); + args->dest = xstrdup(optarg); break; case 'f': free(args->conf_file); - args->conf_file = strdup(optarg); + args->conf_file = xstrdup(optarg); break; case 'o': - args->offline_root = strdup (optarg); + args->offline_root = xstrdup(optarg); break; case 'p': - args->offline_root_path = strdup (optarg); + args->offline_root_path = xstrdup(optarg); break; case 'n': args->noaction = 1; break; case 't': - args->tmp_dir = strdup(optarg); + args->tmp_dir = xstrdup(optarg); break; case 'v': print_version(); @@ -196,7 +197,7 @@ int args_parse(args_t *args, int argc, char *argv[]) break; case ARGS_OPT_CACHE: free(args->cache); - args->cache = strdup(optarg); + args->cache = xstrdup(optarg); break; case ARGS_OPT_FORCE_DEFAULTS: args->force_defaults = 1; -- cgit v0.9.1