Browse Source

fix possible null pointer reference

fixes #709

Change-Id: I65f9ad85547f12b12202dd0f76b34b00525b96ca
changes/32/25932/7
Richard Fuchs 7 years ago
parent
commit
072bfb8a45
3 changed files with 5 additions and 3 deletions
  1. +3
    -2
      recording-daemon/db.c
  2. +1
    -1
      recording-daemon/tag.c
  3. +1
    -0
      recording-daemon/tag.h

+ 3
- 2
recording-daemon/db.c View File

@ -6,6 +6,7 @@
#include "types.h"
#include "main.h"
#include "log.h"
#include "tag.h"
static MYSQL __thread *mysql_conn;
@ -286,8 +287,8 @@ void db_do_stream(metafile_t *mf, output_t *op, const char *type, stream_t *stre
.buffer_length = sizeof(ssrc),
.is_unsigned = 1,
};
if (stream && mf->tags->len > stream->tag) {
tag_t *tag = g_ptr_array_index(mf->tags, stream->tag);
if (stream) {
tag_t *tag = tag_get(mf, stream->tag);
my_cstr(&b[9], tag->label ? : "");
}
else


+ 1
- 1
recording-daemon/tag.c View File

@ -2,7 +2,7 @@
// XXX copied from stream.c - unify?
static tag_t *tag_get(metafile_t *mf, unsigned long id) {
tag_t *tag_get(metafile_t *mf, unsigned long id) {
if (mf->tags->len <= id)
g_ptr_array_set_size(mf->tags, id + 1);
tag_t *ret = g_ptr_array_index(mf->tags, id);


+ 1
- 0
recording-daemon/tag.h View File

@ -3,6 +3,7 @@
#include "types.h"
tag_t *tag_get(metafile_t *mf, unsigned long id);
void tag_name(metafile_t *mf, unsigned long t, const char *);
void tag_label(metafile_t *mf, unsigned long t, const char *);
void tag_free(tag_t *);


Loading…
Cancel
Save