ofp-parse: Use xstrdup() instead of strdup().
authorBen Pfaff <blp@ovn.org>
Mon, 11 Jan 2016 17:21:58 +0000 (09:21 -0800)
committerBen Pfaff <blp@ovn.org>
Mon, 11 Jan 2016 23:01:36 +0000 (15:01 -0800)
This avoids a null pointer dereference in the case of memory allocation
failure.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Russell Bryant <russell@ovn.org>
lib/ofp-parse.c

index 822a298..4bd8521 100644 (file)
@@ -899,7 +899,7 @@ parse_ofp_table_vacancy(struct ofputil_table_mod *tm, const char *setting)
 {
     char *save_ptr = NULL;
     char *vac_up, *vac_down;
-    char *value = strdup(setting);
+    char *value = xstrdup(setting);
     char *ret_msg;
     int vacancy_up, vacancy_down;