[vlc-commits] [Git][videolan/vlc][master] 5 commits: musicbrainz: fix return of musicbrainz_lookup()

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Nov 23 08:46:54 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
02873a57 by Johannes Kauffmann at 2024-11-23T08:21:13+00:00
musicbrainz: fix return of musicbrainz_lookup()

- - - - -
c9342edc by Johannes Kauffmann at 2024-11-23T08:21:13+00:00
musicbrainz: refactor with early returns

- - - - -
60ebe9e2 by Johannes Kauffmann at 2024-11-23T08:21:13+00:00
musicbrainz: reindent after last commit

No functional changes.

- - - - -
f31f0707 by Johannes Kauffmann at 2024-11-23T08:21:13+00:00
musicbrainz: factor free() calls

- - - - -
2edddb01 by Johannes Kauffmann at 2024-11-23T08:21:13+00:00
musicbrainz: fix leak

- - - - -


1 changed file:

- modules/misc/webservices/musicbrainz.c


Changes:

=====================================
modules/misc/webservices/musicbrainz.c
=====================================
@@ -55,22 +55,26 @@ static musicbrainz_lookup_t * musicbrainz_lookup(vlc_object_t *p_obj, const char
         return NULL;
 
     musicbrainz_lookup_t *p_lookup = musicbrainz_lookup_new();
-
-    if(p_lookup)
+    if (!p_lookup)
     {
-        struct json_helper_sys sys;
-        sys.logger = p_obj->logger;
-        sys.buffer = p_buffer;
-        sys.size = i_buffer;
-
-        int val = json_parse(&sys, &p_lookup->json);        
-        if (val) {
-            msg_Dbg( p_obj, "error: could not parse json!");
-            free(p_buffer);
-            return false;
-        }
+        free(p_buffer);
+        return NULL;
     }
+
+    struct json_helper_sys sys;
+    sys.logger = p_obj->logger;
+    sys.buffer = p_buffer;
+    sys.size = i_buffer;
+
+    int val = json_parse(&sys, &p_lookup->json);
     free(p_buffer);
+    if (val)
+    {
+        msg_Dbg( p_obj, "error: could not parse json!");
+        musicbrainz_lookup_release(p_lookup);
+        return NULL;
+    }
+
     return p_lookup;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/99c6d056e32c3f347ed8c04baf1e8fb0a0346a68...2edddb01da361d1040736d7fda637e118ea6aee1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/99c6d056e32c3f347ed8c04baf1e8fb0a0346a68...2edddb01da361d1040736d7fda637e118ea6aee1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list