Mercurial > dropbear
comparison libtomcrypt/demos/constants.c @ 1733:d529a52b2f7c coverity coverity
merge coverity from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 Jun 2020 21:07:34 +0800 |
parents | e9dba7abd939 |
children |
comparison
equal
deleted
inserted
replaced
1643:b59623a64678 | 1733:d529a52b2f7c |
---|---|
63 char *names_list; | 63 char *names_list; |
64 unsigned int names_list_len; | 64 unsigned int names_list_len; |
65 /* get and print the length of the names (and values) list */ | 65 /* get and print the length of the names (and values) list */ |
66 if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE); | 66 if (crypt_list_all_constants(NULL, &names_list_len) != 0) exit(EXIT_FAILURE); |
67 /* get and print the names (and values) list */ | 67 /* get and print the names (and values) list */ |
68 names_list = malloc(names_list_len); | 68 if ((names_list = malloc(names_list_len)) == NULL) exit(EXIT_FAILURE); |
69 if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE); | 69 if (crypt_list_all_constants(names_list, &names_list_len) != 0) exit(EXIT_FAILURE); |
70 printf("%s\n", names_list); | 70 printf("%s\n", names_list); |
71 free(names_list); | |
71 } | 72 } |
72 } else if (argc == 3) { | 73 } else if (argc == 3) { |
73 if (strcmp(argv[1], "-s") == 0) { | 74 if (strcmp(argv[1], "-s") == 0) { |
74 int value; | 75 int value; |
75 if (crypt_get_constant(argv[2], &value) != 0) exit(EXIT_FAILURE); | 76 if (crypt_get_constant(argv[2], &value) != 0) exit(EXIT_FAILURE); |