aboutsummaryrefslogtreecommitdiff
path: root/doc/tutorial.rst
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2013-03-09 21:15:09 +0200
committerPetri Lehtinen <petri@digip.org>2013-03-09 21:15:09 +0200
commit3d0d61fdaf57b6b819ca0c359e7341c37053ab00 (patch)
treec3fc89116621de348de417c29ea9a177a9256121 /doc/tutorial.rst
parenta1882fee02671245000d9b8a41cbff5a31243d8f (diff)
downloadjansson-3d0d61fdaf57b6b819ca0c359e7341c37053ab00.zip
jansson-3d0d61fdaf57b6b819ca0c359e7341c37053ab00.tar.gz
jansson-3d0d61fdaf57b6b819ca0c359e7341c37053ab00.tar.bz2
Use json_decref() properly in tutorial
Diffstat (limited to 'doc/tutorial.rst')
-rw-r--r--doc/tutorial.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/tutorial.rst b/doc/tutorial.rst
index 79bd3b5..c2df081 100644
--- a/doc/tutorial.rst
+++ b/doc/tutorial.rst
@@ -178,6 +178,7 @@ We check that the returned value really is an array::
if(!json_is_array(root))
{
fprintf(stderr, "error: root is not an array\n");
+ json_decref(root);
return 1;
}
@@ -192,6 +193,7 @@ Then we proceed to loop over all the commits in the array::
if(!json_is_object(data))
{
fprintf(stderr, "error: commit data %d is not an object\n", i + 1);
+ json_decref(root);
return 1;
}
...
@@ -209,6 +211,7 @@ object. We also do proper type checks::
if(!json_is_string(sha))
{
fprintf(stderr, "error: commit %d: sha is not a string\n", i + 1);
+ json_decref(root);
return 1;
}
@@ -216,6 +219,7 @@ object. We also do proper type checks::
if(!json_is_object(commit))
{
fprintf(stderr, "error: commit %d: commit is not an object\n", i + 1);
+ json_decref(root);
return 1;
}
@@ -223,6 +227,7 @@ object. We also do proper type checks::
if(!json_is_string(message))
{
fprintf(stderr, "error: commit %d: message is not a string\n", i + 1);
+ json_decref(root);
return 1;
}
...