diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2017-05-30 10:30:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-02 09:36:06 +0900 |
commit | 9ef7223058a44990dc4650ecb1209c97ceb636b3 (patch) | |
tree | e3aa8240bac2be6a2bf5ad158023ec31a67d3457 /remote-testsvn.c | |
parent | 490bc83a01acfefa11e98f8852b1f4a9dd962331 (diff) | |
download | git-9ef7223058a44990dc4650ecb1209c97ceb636b3.tar.gz |
notes: make get_note return pointer to struct object_id
Make get_note return a pointer to a const struct object_id. Add a
defensive check to ensure we don't accidentally dereference a NULL
pointer.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote-testsvn.c')
-rw-r--r-- | remote-testsvn.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/remote-testsvn.c b/remote-testsvn.c index 793c4ad1d9..017af1bd5f 100644 --- a/remote-testsvn.c +++ b/remote-testsvn.c @@ -53,15 +53,15 @@ static void terminate_batch(void) /* NOTE: 'ref' refers to a git reference, while 'rev' refers to a svn revision. */ static char *read_ref_note(const unsigned char sha1[20]) { - const unsigned char *note_sha1; + const struct object_id *note_oid; char *msg = NULL; unsigned long msglen; enum object_type type; init_notes(NULL, notes_ref, NULL, 0); - if (!(note_sha1 = get_note(NULL, sha1))) + if (!(note_oid = get_note(NULL, sha1))) return NULL; /* note tree not found */ - if (!(msg = read_sha1_file(note_sha1, &type, &msglen))) + if (!(msg = read_sha1_file(note_oid->hash, &type, &msglen))) error("Empty notes tree. %s", notes_ref); else if (!msglen || type != OBJ_BLOB) { error("Note contains unusable content. " |