Use xstrdup() instead of strdup(), xmalloc() instead of malloc().
authorBen Pfaff <blp@nicira.com>
Tue, 22 Jul 2014 22:46:25 +0000 (15:46 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 22 Jul 2014 22:59:36 +0000 (15:59 -0700)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
lib/daemon-windows.c
lib/stream-tcp.c
lib/unixctl.c
tests/test-odp.c
tests/test-vconn.c

index 33b3b36..3d1907e 100644 (file)
@@ -478,7 +478,7 @@ char *
 make_pidfile_name(const char *name)
 {
     if (name && strchr(name, ':')) {
-        return strdup(name);
+        return xstrdup(name);
     } else {
         return xasprintf("%s/%s.pid", ovs_rundir(), program_name);
     }
index 0a1ba6b..5d0602a 100644 (file)
@@ -106,7 +106,7 @@ windows_open(const char *name, char *suffix, struct stream **streamp,
     if (!strchr(suffix, ':')) {
         path = xasprintf("%s/%s", ovs_rundir(), suffix);
     } else {
-        path = strdup(suffix);
+        path = xstrdup(suffix);
     }
 
     file = fopen(path, "r");
@@ -229,7 +229,7 @@ pwindows_open(const char *name OVS_UNUSED, char *suffix,
     if (!strchr(suffix, ':')) {
         path = xasprintf("%s/%s", ovs_rundir(), suffix);
     } else {
-        path = strdup(suffix);
+        path = xstrdup(suffix);
     }
 
     error = new_pstream(suffix_new, pstreamp, dscp, path, false);
index c982214..876c226 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -224,7 +224,7 @@ unixctl_server_create(const char *path, struct unixctl_server **serverp)
 #ifndef _WIN32
         abs_path = abs_file_name(ovs_rundir(), path);
 #else
-        abs_path = strdup(path);
+        abs_path = xstrdup(path);
 #endif
         punix_path = xasprintf("punix:%s", abs_path);
         free(abs_path);
@@ -438,7 +438,7 @@ unixctl_client_create(const char *path, struct jsonrpc **client)
     int error;
 
 #ifdef _WIN32
-    abs_path = strdup(path);
+    abs_path = xstrdup(path);
 #else
     abs_path = abs_file_name(ovs_rundir(), path);
 #endif
index c040970..b8d4f80 100644 (file)
@@ -149,7 +149,7 @@ parse_filter(char *filter_parse)
 
     vlog_set_levels_from_string_assert("odp_util:console:dbg");
     if (filter_parse && !strncmp(filter_parse, "filter=", 7)) {
-        filter = strdup(filter_parse+7);
+        filter = xstrdup(filter_parse + 7);
         memset(&flow_filter, 0, sizeof(flow_filter));
         memset(&wc_filter, 0, sizeof(wc_filter));
 
index 8a2efa3..266ad4e 100644 (file)
@@ -61,7 +61,7 @@ static void
 check_errno(int a, int b, const char *as, const char *file, int line)
 {
     if (a != b) {
-        char *str_b = strdup(ovs_strerror(abs(b)));
+        char *str_b = xstrdup(ovs_strerror(abs(b)));
         ovs_fatal(0, "%s:%d: %s is %d (%s) but should be %d (%s)",
                   file, line, as, a, ovs_strerror(abs(a)), b, str_b);
     }