Commit 5b4fa2e7 authored by conrad's avatar conrad

add NULL return checks

for ticket:440, reported by Coverity


git-svn-id: http://svn.annodex.net/liboggz/trunk@3792 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 593a3c26
...@@ -424,6 +424,8 @@ typedef int (*OggzOrder) (OGGZ * oggz, ogg_packet * op, void * target, ...@@ -424,6 +424,8 @@ typedef int (*OggzOrder) (OGGZ * oggz, ogg_packet * op, void * target,
* \retval 0 Success * \retval 0 Success
* \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ * \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
* \retval OGGZ_ERR_INVALID Operation not suitable for this OGGZ * \retval OGGZ_ERR_INVALID Operation not suitable for this OGGZ
* \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not identify an existing
* logical bitstream in \a oggz, and is not -1
*/ */
int oggz_set_order (OGGZ * oggz, long serialno, OggzOrder order, int oggz_set_order (OGGZ * oggz, long serialno, OggzOrder order,
void * user_data); void * user_data);
......
...@@ -594,6 +594,8 @@ oggz_set_order (OGGZ * oggz, long serialno, ...@@ -594,6 +594,8 @@ oggz_set_order (OGGZ * oggz, long serialno,
oggz->order_user_data = user_data; oggz->order_user_data = user_data;
} else { } else {
stream = oggz_get_stream (oggz, serialno); stream = oggz_get_stream (oggz, serialno);
if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
stream->order = order; stream->order = order;
stream->order_user_data = user_data; stream->order_user_data = user_data;
} }
......
...@@ -745,6 +745,8 @@ chop (OCState * state) ...@@ -745,6 +745,8 @@ chop (OCState * state)
oggz = oggz_open (state->infilename, OGGZ_READ|OGGZ_AUTO); oggz = oggz_open (state->infilename, OGGZ_READ|OGGZ_AUTO);
} }
if (oggz == NULL) return -1;
if (state->outfilename == NULL) { if (state->outfilename == NULL) {
state->outfile = stdout; state->outfile = stdout;
} else { } else {
......
...@@ -359,13 +359,17 @@ list_comments (OCData * ocdata) ...@@ -359,13 +359,17 @@ list_comments (OCData * ocdata)
static void static void
store_comment (OCData * ocdata, char * s) store_comment (OCData * ocdata, char * s)
{ {
char * c, * name, * value; char * c, * name, * value = NULL;
c = strchr (s, '='); if (s == NULL) return;
*c = '\0';
name = s; name = s;
value = c+1;
c = strchr (s, '=');
if (c != NULL) {
*c = '\0';
value = c+1;
}
oggz_comment_add_byname (ocdata->storer, S_SERIALNO, name, value); oggz_comment_add_byname (ocdata->storer, S_SERIALNO, name, value);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment