Pretty: fix use of uninitialised variable
The string chunk getter doesn't set ptr if there was an error
decoding. Instead, we need to deal with the error first.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
diff --git a/src/cborpretty.c b/src/cborpretty.c
index b8825de..b0a3db8 100644
--- a/src/cborpretty.c
+++ b/src/cborpretty.c
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 Intel Corporation
+** Copyright (C) 2019 Intel Corporation
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
@@ -422,6 +422,8 @@
}
err = _cbor_value_get_string_chunk(it, &ptr, &n, it);
+ if (err)
+ return err;
if (!ptr)
break;