Skip to content

Commit

Permalink
ofp-parse: Use xstrdup() instead of strdup().
Browse files Browse the repository at this point in the history
This avoids a null pointer dereference in the case of memory allocation
failure.

Found by inspection.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Russell Bryant <[email protected]>
  • Loading branch information
blp committed Jan 11, 2016
1 parent dcf5840 commit b7407f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ofp-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,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;

Expand Down

0 comments on commit b7407f2

Please sign in to comment.