diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-05-13 16:39:35 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2012-05-13 16:39:35 -0400 |
commit | 06323619397520aba2fc2f8f983d67d06c6610fa (patch) | |
tree | 491b6c4342a1ba34fa853d129ca89d672efe4da6 /extension/filefuncs.c | |
parent | 3d662631342d999b3c80952f2e8eca8b390bdd95 (diff) | |
download | egawk-06323619397520aba2fc2f8f983d67d06c6610fa.tar.gz egawk-06323619397520aba2fc2f8f983d67d06c6610fa.tar.bz2 egawk-06323619397520aba2fc2f8f983d67d06c6610fa.zip |
Add comment to extension/filefuncs.c discussing unref on value from assoc_lookup.
Diffstat (limited to 'extension/filefuncs.c')
-rw-r--r-- | extension/filefuncs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 9758ba8e..01f3fce2 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -220,6 +220,13 @@ array_set(NODE *array, const char *sub, NODE *value) tmp = make_string(sub, strlen(sub)); aptr = assoc_lookup(array, tmp); unref(tmp); + /* + * Note: since we initialized with assoc_clear, we know that aptr + * has been initialized with Nnull_string. Thus, the call to + * unref(*aptr) is not strictly necessary. However, I think it is + * generally more correct to call unref to maintain the proper + * reference count. + */ unref(*aptr); *aptr = value; } |