pesign/0005-Fix-check-for-allocations-on-tokenname-certname.patch
2012-10-19 19:19:24 -04:00

39 lines
1.2 KiB
Diff

From 844138e07535a8aa2be80496378c9929acaa1687 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 17 Oct 2012 10:35:41 -0400
Subject: [PATCH 05/42] Fix check for allocations on tokenname,certname.
If we didn't have anything to start with, we won't have anything when
we're done...
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/pesign.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pesign.c b/src/pesign.c
index 4ddf636..c7b23cf 100644
--- a/src/pesign.c
+++ b/src/pesign.c
@@ -553,7 +553,7 @@ main(int argc, char *argv[])
ctx.cms_ctx->tokenname = tokenname ?
PORT_ArenaStrdup(ctx.cms_ctx->arena, tokenname) : NULL;
- if (!ctx.cms_ctx->tokenname) {
+ if (tokenname && !ctx.cms_ctx->tokenname) {
fprintf(stderr, "could not allocate token name: %s\n",
PORT_ErrorToString(PORT_GetError()));
exit(1);
@@ -561,7 +561,7 @@ main(int argc, char *argv[])
ctx.cms_ctx->certname = certname ?
PORT_ArenaStrdup(ctx.cms_ctx->arena, certname) : NULL;
- if (!ctx.cms_ctx->certname) {
+ if (certname && !ctx.cms_ctx->certname) {
fprintf(stderr, "could not allocate certificate name: %s\n",
PORT_ErrorToString(PORT_GetError()));
exit(1);
--
1.7.12.1