summaryrefslogtreecommitdiff
path: root/cmd/pk12util
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2016-06-21 09:59:03 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2016-06-21 09:59:03 +1000
commitf0cf1974eb79c8184341db0e4bc62e7edd13c5c0 (patch)
tree910af7478153c4845e7d987ee39410ecdcbaaee0 /cmd/pk12util
parenta19d9e206e7e4e82d42070d47941ed20c453f907 (diff)
downloadnss-hg-f0cf1974eb79c8184341db0e4bc62e7edd13c5c0.tar.gz
Bug 1280844 - Fix up null checks in cmd/. r=mt.
This patch: - Adds some missing null checks after allocations. - Moves some derefs of pointers after null checks of those same pointers. - Removes some redundant null checks for pointers that are guaranteed to be non-null. MozReview-Commit-ID: FAva5Wg5fr
Diffstat (limited to 'cmd/pk12util')
-rw-r--r--cmd/pk12util/pk12util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/pk12util/pk12util.c b/cmd/pk12util/pk12util.c
index 91f8cadca..43ddd1874 100644
--- a/cmd/pk12util/pk12util.c
+++ b/cmd/pk12util/pk12util.c
@@ -211,6 +211,9 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode,
it.data = inBuf;
it.len = inBufLen;
dup = SECITEM_DupItem(&it);
+ if (!dup) {
+ return PR_FALSE;
+ }
/* If converting Unicode to ASCII, swap bytes before conversion
* as neccessary.
*/
@@ -223,8 +226,7 @@ p12u_ucs2_ascii_conversion_function(PRBool toUnicode,
/* Perform the conversion. */
ret = PORT_UCS2_UTF8Conversion(toUnicode, dup->data, dup->len,
outBuf, maxOutBufLen, outBufLen);
- if (dup)
- SECITEM_ZfreeItem(dup, PR_TRUE);
+ SECITEM_ZfreeItem(dup, PR_TRUE);
#ifdef DEBUG_CONVERSION
if (pk12_debugging) {